Mac OS X 10.5 (Leopard) – Webserver (Apache), MySQL and php
I have just got around to checking out some of my php/MySQL websites I have on my MacBook after upgrading to Mac OS X 10.5 (Leopard). And the good news is everything appears to work, but a few tweaks were needed.
After upgrading to Mac OS X 10.5 (Leopard) the webserver was turned off (security?). Turning it back on was a easy, System Preferences > Sharing, click on ‘Web Sharing’. However, after turning on Apache was no longer pointing to my ‘Site’ folder on http://localhost, but a directory called /Library/WebServer/Documents – most annoying. Plus, php was dead….
To get things working I had to change three lines in the httpd.conf file (After I had made a back up of it!), which is located at /private/etc/apache2/httpd.conf .
Change 1 to get php working:
Change line 114 from:
#LoadModule php5_module libexec/apache2/libphp5.so
to:
LoadModule php5_module libexec/apache2/libphp5.so
(i.e. remove the hash/pound sign at the start)
Change 2 to get Apache ‘pointing’ at my ‘Sites’ folder
Change line 163 from:
DocumentRoot “/Library/WebServer/Documents”
to:
DocumentRoot “/Users/my-home-user-folder/Sites”
Where my-home-user-folder is the name of my home folder.
Change 3 to get Apache ‘pointing’ at my ‘Sites’ folder
(If you don’t do this you will be given a 403 – Insufficient User Privileges for Access)
Change line 190 from:
Directory “/Library/WebServer/Documents”
to:
Directory “/Users/my-home-user-folder/Sites”
Where my-home-user-folder is the name of my home folder.
Finally, you may wish to change any other occurrence of /Library/WebServer/Documents to /Users/my-home-user-folder/Sites if you use an CGI scripts in you home sites directory.
Finally, restart Apache from System Preferences.
MySQL seems to be working fine (I am using version 5), and CocoaMySQL is working… great!