Installing WordPress on Mac OS X 10.5.8

Installing WordPress wasn’t very hard, but it was not as smooth as the claims. I hope to share how it went for me, so your installation may be smoother.

First I downloaded the WordPress software as instructed. Then I unzipped the files and started filling out the config file. Except I couldn’t because I needed a database.

Getting the database going for me was the hard part. I have a MySQL database installed on my webserver, but I installed it about a year ago, and I couldn’t remember how to use it, what my password was: all that stuff. So I determined that I still had the server:
$ which mysql
and started it running.
$ sudo bin/mysqld_safe5 --user=mysql
I still needed a password, but I learned how to reset the password. See link. I also added –skip-networking to keep the database safe.
$ sudo bin/mysqld_safe5 --user=mysql --skip-grant-tables --skip-networking
$ cntrl-z
$ bg
$ mysql --user=root -p
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
mysql> quit;

I then stopped and restarted the database server normally, and tested that I could access it. I created a database just for WordPress, as directed, and I updated the config.

Now I should be all set, right? But even though I could connect to the database from the command line, I couldn’t connect via WordPress. A bunch of Google searching later, I found that WordPress (and any PHP process) was looking for the socket to the database at /var/mysql. This can be configured in the /etc/php.ini file. Unfortunately mysql was running with the socket at /opt/local/var/run/mysql5/mysqld.sock. I am sure this can be configured too. I fixed the problem by putting a link to the socket in /var:
$ ln -s /opt/local/var/run/mysql5/mysqld.sock /var/mysql

At this point, I was almost there. WordPress seemed to come up, and I could log in, and start building my website. There was one more stumbling block however. Although a lot of WordPress was working, the categories and pretty links were not. It turns out that you have to turn mod_rewrite on. WordPress explains how to do this in a .htaccess file. On a mac, .htaccess files are turned off by default. One solution is to turn .htaccess files on, and include the options and commands in the .htaccess file in the root of the WordPress install.

After reading more about .htaccess, mod_rewrite, and security, I decided to stay away from .htaccess. They seemed to insecure to me, especially if you have a directory for uploading files that user=www can write to. Instead, I included the options for mod_rewrite directly in my httpd.conf file. I use the <directory> syntax to make sure these options only applied to WordPress. For my upload directory, I made sure to keep very restrictive options.

#       This is access control granted for WordPress perm_link re-writing
#       It allows WordPress to create and remap URLs to access the website
#       WordPress in currently only in the wp subdirectory of DocumentRoot
#       So we only enable access starting there.
<Directory "/Library/WebServer/Documents/wp">
        <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /wp/
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /wp/index.php [L]

#       The uploads directory is writable by group=www, so it needs special
#       protection.  CGI-scripts must not be served from there.

<Directory "/Library/WebServer/Documents/wp/uploads">
        Options None
    AllowOverride None
    Order deny,allow
    Allow from All


Well, that’s it for now.  WordPress seems to be up and working.  So much so that I can use it to enter this blog post.  I amd still just testing, and I still have more to do.  For instance, in a later post, I probably want to explain the httpd.conf options discussed above: why these options, and how they work.  But for now, let’s get this post posted already!

Hello world!

Hello World! WordPress Logo

This is my migrated website based on WordPress technology. For now, I am just trying on WordPress for size, but so far so good. If the migration goes as planned, registered users can blog and contribute remotely using just a web browser. No special access directly to the server is required.

Pictures from SCA May War


On Memorial day weekend, as usual, the SCA (society for creative anachronism) went to war. I like to join them for the whole weekend, but with our England trip upon us, I could only afford one day and one night. But the really great thing was that Pam came too. And the dogs. What fun. Anyway, there are pictures. See Events:May War.