Mac comes with version php5.6. Since php7 brings many new features and performance improvements, we decided to upgrade php7
Enter the following command to install php7. 1. Installation package. During the installation process, you need to enter the system password
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1
Open the terminal and enter php -v. Why is it still prompted that the version is php5.6?
php-osx will not overwrite the original version. Instead, two PHP versions are installed. The root directory of the new version of PHP7.1 is /usr/local/php5, and the startup script path is /usr/local/php5/bin/php.
You can open the terminal, Temporarily adjust the system variable path by the following method (it will become invalid immediately after closing the terminal)
export PATH=/usr/local/php5/bin:$PATH
You can also permanently modify it by adding php7 to the environment variable by the following method
sudo vim ~/.bash_profile
Write in the file
#export PHP PATH This is a comment, you can delete it
export PATH=/usr/local/php5/bin:$PATH
Finally, run the following command
source ~/.bash_profile
After the installation is completed, php -m, you will find that even xdebug and Zend OPcache are also Installed together
The above is the detailed content of MacOS upgrade comes with PHP5.6 and upgrade to PHP7.1. For more information, please follow other related articles on the PHP Chinese website!