Mac OS comes with PHP versions, but many extensions are not.
This site: http://php-osx.liip.ch/provides almost all of the PHP versions
By entering
Curl-s http://php-osx.liip.ch/install.sh | Bash-s 5.6
You can install the latest installation package for 5.6 and include most of the extension libraries.
After installation, a php5-xxx directory will be added under/usr/local/and found in this directory entropy-php.conf
LoadModule php5_module/usr/local/php5/libphp5.so
Copy this line of code and find it in the/etc/apache2/httpd.conf
LoadModule Php5_module libexec/apache2/libphp5.so
Annotate it and add the address you copied above, as follows.
#LoadModule Php5_module Libexec/apache2/libphp5.soloadmodule php5_module/usr/local/php5/libphp5.so
Restart Apache apachectl Restart after saving
Apache2 PHP version of the switch, if you want to php-v also use the latest version of the operation.
VI ~/. profile//There is no edit, just create a new this file name.
Input
Export Path=/usr/local/php5/bin:/usr/local/php5/sbin: $PATH
Clear the cache so that it takes effect
SOURCE ~/. Profile
And then Php-v is already the latest version.
Mac PHP Version switching