Enabling Apache and PHP on a Mac 10.6 (Snow Leopard)
The Apache web server and PHP come preinstalled on Macs. All you have to do is enable it. Unfortunately, there is no “Enable Apache and PHP” switch, but the process is relatively simple.
To first enable PHP5, using a Terminal navigate to “/etc/apache2/”
cd /etc/apache2
and sudo open up the httpd.conf file using your editor of choice.
Next, find this line:
#LoadModule php5_module libexec/apache2/libphp5.so
and uncomment it by removing the ‘#’. Save and close. Now PHP5 is enabled.
Next, we need to turn on the Apache web server (or reboot it if it’s already running). Open up System Preferences from the Apple menu. Click on Sharing. Under the list of options in the toolbar on the left, check (or uncheck-then check) the “Web Sharing” option. This will effectively activate the apache web server.

That’s it! Now open up a web browser and type http://localserver/ and it should give you a happy “It Works!” confirmation that Apache is up. Your home directory is located at http://localserver/~username and you can navigate to your websites and run PHP scripts.