Enabling PHP in OS X 10.5 and 10.6

This enables php in the Sites folder!

Launch Terminal and and then type the following command

sudo pico /private/etc/apache2/httpd.conf

Enter password

Press Ctrl+W to do a search in GNU nano.

Type php and press Return.

The following line should be displayed:

#LoadModule php5_module libexec/apache2/libphp5.so

Use the arrow keys to move the cursor and the backspace key to remove the # at the beginning of the line. The line should then be look like this:

LoadModule php5_module libexec/apache2/libphp5.so

Press Ctrl+O and then press Return to confirm that you want to save.

Press Ctrl-X to quit GNU nano.

The PHP installation in 10.5 doesn't have an editable php.ini file, so we need to create it from the included default file.

In the Terminal, type or paste the following command:

sudo cp /private/etc/php.ini.default /private/etc/php.ini

You now need to restart the Apache server to make it use the new configuration. Type:

sudo apachectl graceful

In the OS X shell and press Return. Enter the Admin password and press Return.

Enable short tags, launch the Terminal manually and and then type the following command:

sudo pico /private/etc/php.ini

Find this short_open_tag = Off

And change it to this: short_open_tag = On

You now need to restart the Apache server to make it use the new configuration. Type:

sudo apachectl graceful

Tags: , , ,

About Keiron

Web Developer based in the UK. Click here if you want to work with me