How can I uninstall PHP 5.4 and 5.5?

I'm new to PHP and Apache and I think I've messed some things up that I don't know how to fix. After following a tutorial I managed to update to PHP 5.5, and then started having problems. I went to downgrade to PHP 5.4, but then I had more problems, so I tried to re-update to PHP 5.5 and now it's saying it's already installed. However, when I reload my my_phpinfo.php (localhost address) in Firefox, it only shows that I'm running PHP version 5.3.15 which is what I started out with originally.

Can someone give me step by step instructions on how to go in and delete all the PHP 5.4 and 5.5 files I've updated so I can just start over with a clean slate and re-download PHP 5.5 and start again?


I'm assuming that the deployment/install script was put at /usr/local/packager/packager.py when it was installed. Apparently, you can use this script to list the packages that are installed:

/usr/local/packager/packager.py list

Unfortunately, the script that you used to install PHP doesn't appear to have an uninstall feature. However, you should be able to remove the installed content that was installed from /usr/local. It is probably a good idea to examine the contents of the /usr/local directory first to confirm the contents:

ls -al /usr/local

From what I can see, the script is installing the software with prefixes like "php5-*", and is linking to the 'current' version of that software using a symbolic link named "php5". The commands below will unlink the symlink, and remove the installed versions of PHP that were installed using the script mentioned above:

sudo unlink /usr/local/php5
sudo rm -rf /usr/local/php5-*

To remove the supplemental configuration file that was installed with the updated PHP software, you may be able to remove the config file at /etc/apache2/other/+php-osx.conf:

sudo rm -rf /etc/apache2/other/+php-osx.conf

Then restart Apache:

sudo apachectl restart

Note: the /usr/local folder shouldn't have much inside of it unless you've installed 3rd party software there. You may find a few PHP installs there that have names like "php5-5.3.x...", "php5-5.4.x...", and "php5-5.5.x...". The rm command above should remove any variants of this naming scheme. Removing the additional Apache configuration file should allow Apache to start normally after the module has been removed.