Following my how to setup your mac web development environment, and today moving to Leopard, my entire offline environment is broken - this is entirely due to the move from Apache 1.3 to Apache 2.2.

This article will discuss the changes required to get your multi-host mac dev environment running again with PHP5, MySQL, Apache 2 and Leopard.

READER DISCOUNTSave $50 on terminal.training

I've published 38 videos for new developers, designers, UX, UI, product owners and anyone who needs to conquer the command line today.

Orientation

Since we're running Apache 2.2, it means a few files have new homes. Here's a comparison:

/etc/httpd/httpd.conf => /etc/apache2/httpd.conf
/etc/httpd/users/ => /etc/httpd/users/

Get your virtual hosts back

Copy your .conf from your old httpd/users/ directory in to the new one (above). For example:

cp /etc/httpd/users/remy.conf /etc/apache2/users/remy.conf

If you restart apache (sudo apache restart) you should have the domains pointing to your sites.

PHP5

PHP5 appears to come with Leopard (though I could be wrong, since I upgraded - please feel free to correct me). To re-enable it, within /etc/apache2/httpd.conf, around line 114 - you should find # LoadModule php5_module - uncomment this and restart apache.

Run a little PHP test, and you'll find you're running PHP again.

MySQL

You have two options to get MySQL running again if you have the following error:

Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)

  1. Reinstall PHP5 and compile it with the new path to the MySQL socket (/tmp/mysql.sock)
  2. Change MySQL's conf to run the socket out of the old location

Since Leopard gave me PHP 5.2.4, which according to Entropy PHP, is the latest version for Apache 2.x, I went with option 2.

If you don't already have the MySQL conf in /etc/my.cnf (I didn't), then you need to copy a template out of the support files from MySQL. If you followed the instructions from my previous article - then you'll need to run the following:

sudo cp /usr/local/mysql-standard-5.0.27-osx10.4-i686/support-files/my-small.cnf /etc/my.cnf

Replace small with whatever suits your setup best.

Now follow these steps:

1. Shutdown MySQL

mysqladmin -uroot shutdown

2. Change the conf

Change all occurrences of /tmp/mysql.sock to /var/mysql/mysql.sock

3. Create /var/mysql/

sudo mkdir /var/mysql
sudo chmod 777 /var/mysql

4. Start MySQL back up again

cd /usr/local/mysql/
sudo ./bin/safe_mysqld &

Wrap Up

That should be it. I've tried to document every change I made to get going again, but if you spot any mistakes or have trouble with these instructions let me know and I'll try to help.