Home  >  Article  >  Backend Development  >  mac modify default php version number

mac modify default php version number

藏色散人
藏色散人Original
2021-05-14 09:17:382497browse

How to modify the default php version number on mac: First create a new ".bas_profile" file and edit it; then enter the php version you want in it; finally save and reload the environment variable.

mac modify default php version number

The operating environment of this article: Windows 7 system, PHP version 7.2.7, Dell G3 computer.

Modify the default PHP version under MAC system

I encountered a problem when using mac today, because composer needs to pull laravel5.6, but it prompts me that the php version is too old Low, but I personally use the integrated environment MAMP and have switched to the version of php7.2. Why does this not take effect? After checking, it was because composer detected that it was the PHP version in which the environment variables took effect under mac

$ which php
/usr/local/bin

Thoughts

At first, I wanted to uninstall the environment that comes with mac. I searched online and found all the results. Same thing, I deleted the directory on the left and on the right, but I couldn’t delete it now. When I deleted it under the root user, it prompted me that I didn’t have permission. I was surprised, and I went to Baidu as the root user and couldn’t delete the file, and then it said something about flags. , then I followed the steps to remove flags

#去除flags
Mac
[sudo] chflags nouchg filename

and then executed rm -rf and still got the same result

php: Operation not permitted

gg. This method is different. If anyone has studied it well, please let me know

Change the environment variables to modify the default php version

Create a .bas_profile file and edit it

vim ~/.bash_profile

Then enter the php version you want in it

export PATH=/Applications/MAMP/bin/php/php7.2.7/bin:$PATH
#/Applications/MAMP/bin/php/php7.2.7/bin是我的php版本路径

Save the reload environment Variable

source ~/.bash_profile

Run which php to view the default version of php and get it

mac modify default php version number

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of mac modify default php version number. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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