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.
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
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Chinese version
Chinese version, very easy to use
