Blog of Wonders

php 5.4

I had a little bit of a run around trying to figure this out. So here’s the full process, all in one place for your convenience. This assumes that you have MacPorts installed, but if you don’t, there are several ways of doing so.

Before we get started, be sure to disable OS X’s default Apache install if you haven’t done so already. This can be done by opening System Preferences, going to Sharing and disabling Web Sharing.

This will load the PHP 5.4 module, make index.php the default directory index file and cause files with .php and .phtml extensions to be interrupted by said PHP module.

Next, tell Apache to include your new PHP config file. Open the httpd.conf,

1

sudo vi/opt/local/apache2/conf/httpd.conf

And add this line to the bottom:

1

Include conf/extra/php.conf

Lastly, restart Apache.

1

sudo/opt/local/apache2/bin/apachectl-krestart

You should now have a functional PHP 5.4 environment. Also, don’t forget that you’ll need to reinstall all of your favorite PHP modules. Here’s what I normally roll with. Don’t forget to restart Apache again.