Getting PHP working in Apache2 on Mac OS X Leopard

Posted: September 6, 2008. Tags: Apache

As with OS X Leopard Server, the OS X Leopard standard OS is missing Apache config statements to enable PHP support. Of course with standard Leopard, you don't get the fancy Server Admin tool to let us fix it via a GUI, so we do it by hand:

In /etc/apache2/httpd.conf:

Uncomment the php LoadModule statement:

LoadModule php5_module libexec/apache2/libphp5.so

Then within the <IfModule mime_module> section, add:

AddType application/x-httpd-php php
AddType application/x-httpd-php-source phps
AddType application/x-httpd-php3 php3
AddHandler php5-script php

Start or restart apache via the check box System Preferences -> Sharing -> Web Sharing