Leopard Web Development Setup

I cobbled this together from a few sources to set up your local PHP/MySQL development environment on a stock OS X Leopard installation with VMware Fusion.

Set up virtual hosts

Edit the hosts file

Open the file /private/etc/hosts. At the bottom of the file, enter your local IP address (127.0.0.1) and the name of each site you want to set up:

127.0.0.1 local.site.com

Edit the Windows hosts file

Get your Parallels (vnic0) / VMWare Fusion (vmnet1) virtual machine IP address in Terminal:

ifconfig vnic0

Open the file `c:windowssystem32driversetchosts`. At the bottom of the file, enter your VM IP address (172.16.157.1 or similar) and the name of each site you want to set up:

172.16.157.1 local.site.com

Add the virtual host in Apache

Open the file /private/etc/apache2/extra/httpd-vhosts.conf. You should see:

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

Underneath this, enter this for each site you want to set up:

<virtualhost *:80>
DocumentRoot "/Users/username/Sites/local.site.com"
ServerName local.site.com
</virtualhost>

Activate virtual hosts in Apache

Open the file /private/etc/apache2/httpd.conf Find the line:

# Virtual hosts
#Include /private/etc/apache2/extra/httpd-vhosts.conf

Uncomment the line:

# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf

Permissions

Open the file /etc/apache2/users/username.conf. Modify the file:

<directory "/Users/username/Sites/">
Options All
AllowOverride All
Order allow, deny
Allow from all
</directory>

Restart Apache

In Terminal, execute:

sudo apachectl graceful

Set up MySQL

Specify socket location

If it doesn’t exist, create the PHP configuration file:

sudo cp /etc/php.ini.default /etc/php.ini

Open the file `/etc/php.ini`. Find the line:

mysql.default_socket =

Modify the line:

mysql.default_socket = /private/tmp/mysql.sock


Find the line:

mysqli.default_socket =

Modify the line:

mysqli.default_socket = /private/tmp/mysql.sock

## Restart Apache

In Terminal, execute:

sudo apachectl graceful