Enable php 5 on Apache 2 for Mac OS X Leopard 10.5.3
Notice: Mac OSX 10.5.3 Leopard uses Apache 2 and has different file paths from Mac 10.4.11 Tiger (Apache 1). The older instructions for Apache 2 / Mac OS X 10.4.11 are located here:
www.semiconducted.com/diy-tech/2008/enable-php-on-apache-without-modifying-the-default-httpdconf-file.html
————————–
With this method, you can create your own custom file which will override the default Mac Apache 2 server settings without modifying the original httpd.conf file.
Why not just change the httpd.conf file itself?
Well, Apache updates may overwrite this file with a new default if you reinstall and I find consolidating custom changes in one small file is easier to edit and troubleshoot. You may need admin editing permissions to do this.
How to:
1. Be sure web sharing is turned on from the “sharing” control panel in your System Preferences:
2. PHP is not enabled by default, so you need to switch this on. Open your user-specific .conf file located in the “users” directory:
/private/etc/apache2/users/.conf
The main apache config file (httpd.conf) loads its settings then will load any additional config files within the “users” directory.
3. Paste the following code into your config file:
#LoadModule php5_module libexec/apache2/libphp5.so
This can also be copied and pasted from the original config file: /private/etc/apache2/httpd.conf
or merely de-commented (remove the #) from right there if you want to set that up for all users in one go.
4. That’s it! Save your file, restart web sharing, and you should be good to go.