Upgrading to PHP5 on OS X

I’ve been meaning to upgrade PHP on my macbook for a while now, today I finally got around to it with a little help from Marc Liyanage PHP Package.

Download the installer (~50MB), un-tar and run it. You should not have PHP5 installed on your system. However, you might have to do a bit of fiddling to get it working properly.

These are just the tweaks I needed, you might need to do more or less, but this might be useful in some fashion.

In httpd.conf the PHP4 module was still being loaded, so comment that out and add an entry to load the PHP5 module instead.

#LoadModule php4_module libexec/httpd/libphp4.so
LoadModule php5_module local/php5/libphp5.so

For some reason the PHP5 module was installed at a different path to the oldPHP4 module and all other Apache modules. Rather than move it (and risk other problems) I left it where it was and just used the different path.

Further down httpd.conf there’s another reference to PHP4, just update the number.

AddModule mod_php5.c

Restart Apache so the changes take effect, with sudo apachectl graceful

That should do it.