Apache and PHP on Mac OS X

Apache is automatically installed on OS X but is not enabled by default. To enable, go to System Preferences->Sharing and check the Web Sharing box.

By default, each of the users will have a website at /Users/username/Sites/ which can be accessed at http://localhost/~username/

A possible problem can come if this was an update to OS X 10.5 from a different version. If a “Forbidden 403” error shows up when going to a user homepage, it is missing probably a file in the users directory of the apache configurations (/etc/apache2/users/). Follow the directions at the Apple help site to fix.

Apache has PHP turned off by default, but can be enabled by editing the configuration file at /private/etc/apache2/httpd.conf and uncommenting the line: #LoadModule php5_module.

To get PHP working, need to make the php.ini file, this can be done easily by just moving the default file:
mv /private/etc/php.ini.default /private/etc/php.ini.

Further help on getting PHP working with Apache on OS X 10.5 can be found here.