Home > Backend Development > PHP7 > MacOS upgrade comes with PHP5.6 and upgrade to PHP7.1

MacOS upgrade comes with PHP5.6 and upgrade to PHP7.1

藏色散人
Release: 2023-02-17 14:00:01
forward
3694 people have browsed it

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
Copy after login

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
Copy after login

You can also permanently modify it by adding php7 to the environment variable by the following method

sudo vim ~/.bash_profile
Copy after login

Write in the file

#export PHP PATH This is a comment, you can delete it

export PATH=/usr/local/php5/bin:$PATH
Copy after login

Finally, run the following command

source ~/.bash_profile
Copy after login

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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template