Monday, January 29, 2007

Installing Drupal 5.0 on OS X 10.4

I started by archiving and emptying /Library/Webserver/Documents (I'm using OS X), then unpacked the drupal-5.0 archive there (without the containing drupal-5.0 directory).

I couldn't find the .htaccess file mentioned by Lullabot. I think it might have gotten lost as I moved the files around graphically using the Finder. It was present, however, when I used the commands suggested in the install instructions. Then I got the following error navigating to the install directory with firefox:
The Drupal installer requires write permissions to ./sites/default/settings.php during the installation process.

So my permissions are effed up. Boo. Just doing

chmod 777 ./site/default/settings.php


seems to have corrected the problem.
The location of the programs for connecting to and administering my mysql database haven't been added to my PATH, so I have to remember to go to /usr/local/mysql/bin for now to run them. I created a user for the drupal table as outlined in the INSTALL.mysql.txt.

Great. That seems to have worked. I changed the permissions on the settings.php (back) to 644. And Drupal 5.0 is online. Amazing.

Made a ./files directory and
sudo chown www:admin files
sudo chmod 755 files


Apparently I didn't install the GD library with PHP, so I'll have to recompile it.
Oh! Looks like I can use a precompiled binary put together by www.entropy.ch. I've got Apache 1.3.33. To successfully install the new PHP module (with GD support!), I've got to uncomment the lines that enable the pre-installed PHP module in SERVER_CONFIG_FILE="/etc/httpd/httpd.conf"

Goody! Now my system has PHP 5.2.0 with a bunch of libraries, including the GD library. However, the switch seems to have broken the connection between MySQL and PHP - Drupal can't get to the MySQL database. Ah, PHP is looking for the MySQL socket in /tmp/mysql.sock - exactly the opposite of the problem I was having when installing Vanilla forums a couple weeks ago. The solution was to change the php.ini file (now located at /usr/local/php5/lib/php.ini) to override the compiled-in default and look for the MySQL socket at /var/mysql/mysql.sock, which is "more secure," according to this apple developer document. It took me a while to realize the personal web sharing control panel buttons weren't actually causing httpd to restart and reload the php.ini file, nor was apachectl graceful commands, for reasons I don't understand. Rebooting did the trick.

The only task left is to set up the cron jobs. Then I'll have a completely generic drupal install.

Edit: got the cron working (with curl - wget and lynx are not pre-installed binaries on OS X). There was a little trick to get the clean URLs to work - the httpd.conf file has to be changed to allow .htaccess overrides. The Mac OS X specific guidelines explain it:
In httpd.conf (in /etc/httpd), locate the following section and allow overrides, so that Drupal's clean urls will work (they depend upon rewrite rules in .htaccess). You'll need to be root (or sudo) to do this. Don't forget to restart apache after modifying httpd.conf (turn personal web sharing off, then back on again, or use /usr/sbin/apachectl restart).

No comments: