Know installation source of PHP
PHP 5.5.30 (cli) (built: Oct 23 2015 17:21:45) is the version of php shipped by Apple with OS X 10.11.3.

You can use brew to install a current version of php – without affecting the built-in version.

brew installs its binaries in /usr/local/Cellar. A modification to your PATH ensures the brew installed version is found before the OS X provided version.

MacPorts uses a similar approach. Which package provider you use is a matter of personal preference.

Install php via brew

To install php via brew, first install brew using the instructions on their web site:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


Then install php:

brew install php


Remove php via brew

When you need to remove php installed via brew – thus reverting php back to the version shipped with OS X – run:

brew uninstall php