The PHP version that comes with OS X 10.11 is php 5.5.x, what if we want to update the PHP version to 5.6 or 7.0?
Download and install PHP 5.6
Open the terminal and run the following command:
-s http://php-osx.liip.ch/install.sh | bash -s 5.6
The version of PHP 5.6 will then be installed in the following path:
/usr/local/php5/
Download and install PHP 7.0
Open the terminal and run the following command:
-s http://php-osx.liip.ch/install.sh | bash -s 7.0
After you enter, you will see a warning under EI Capitan:
10.11. As this is quite new, there may be issues still. Your mileage may vary.
Do not worry about this warning, wait for the download installation is complete.
Configuration path
Installation complete If you run the PHP-V command in the terminal, the old version of the Mac comes with it. Therefore, we also need to configure the path.
Enter the following command on the command line:
sudo vim ~/.bash_profile
Then, at the end of the file, add:
export PATH=/usr/local/php5-7.0.7-20160526-160257/bin:$PATH;
Note: I am configuring the path of the installed PHP7.0, you need to go to/usr/local to see the path of the PHP you have installed.
Finally, run the command:
source ~/.bash_profile
Configuration is complete, try again php-v display is the latest installed PHP version.
Update your own PHP version to 5.6 or 7.0 under Mac