Leopard brings one big change to web developers working with Apache, PHP and Mysql on the Mac. Apache 2 comes with Leopard along with PHP 5.
Here is what to do to restore a test environment.
First, you need to enable PHP.
Apache’s .conf file moved from /private/etc/httpd/httpd.conf to /private/etc/apache2/httpd.conf
Open this file with your favorite text editor and uncomment the line:
# LoadModule php5_module libexec/apache2/libphp5.so
You don’t need to add the mime type for php, because it’s already done for you under leopard. The last line in the .conf file is:
The ‘other’ directory contains a .conf file for php5. That takes care of the mime type and the index.php configuration for php sites.
If you develop multiple sites and you need virtual hosting functionality, scroll down to the end of the .conf file and uncomment the following:
# Include /private/etc/apache2/extra/httpd-vhosts.conf
That’s all the modification that I had to make to to the httpd.conf file.
Next, you’ll need to setup whatever virtual hosts you have in the virtual hosts file /private/etc/apache2/extra/httpd-vhosts.conf
For example, for each line that you set up in your hosts file like so:
You need to make an entry in the httpd-vhosts.conf file like so:
<VirtualHost *:80> ServerName beta-site-1.com ServerAlias www.beta-site-1.com ServerAdmin firstname.lastname@example.org DocumentRoot "/Library/WebServer/beta-site-1" ScriptAlias /cgi-bin/ "/Library/WebServer/beta-site-1/cgi-bin" <Directory "/Library/WebServer/beta-site-1"> Options FollowSymLinks MultiViews Includes AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
One good thing is that the ‘upgrade’ install of Leopard does not mess with your hosts file, so whatever virtual domains you may have set up won’t be affected.
If you had Mysql installed previously, good news too, Leopard’s installer won’t touch it. I found mysqld running just like before the upgrade.
One thing changed with Leopard is the socket for Mysql. It moved to /private/tmp, so you may need to configure your php.ini file to point it to the new location.
To do so, open the file ‘/private/etc/php.ini‘, (if no such file exists, then make a copy of ‘/private/etc/php.ini.default‘ naming it ‘php.ini‘) and edit that.
You have two lines to modify:
mysql.default_socket = /private/tmp/mysql.sock
and mysqli.default_socket =
mysqli.default_socket = /private/tmp/mysql.sock
of course, from the sharing pref pane, stop the server and restart it and voila!