How to change php version under mac

王林
Release: 2023-03-10 14:02:01
Original
3320 people have browsed it

The method to change the php version under mac is: first create a new [.bas_profile] file; then enter [export PATH=/Applications/MAMP/bin/php/php7.2.7/bin:$PATH in the new file ]; Finally, just reload the environment variables.

How to change php version under mac

The operating environment of this article: macos x system, php 7.2.7, macbook pro computer.

The specific method to modify the default version of php on a mac computer is:

First create a .bas_profile file and edit it

vim ~/.bash_profile
Copy after login

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版本路径
Copy after login

Finally save and reload the environment variable

source ~/.bash_profile
Copy after login

Problems:

The ~/.bash_profile file was modified as above and found to be invalid, and the prompt zsh: command not found: homestead Then it must be because zsh is installed, because ~/.bash_profile will not be executed when zsh is installed. The solution is as follows:

Open vim ~/.zshrc and configure the environment variables you want to configure into this file

Open vim ~/.zshrc and add source ~/.bash_profile, like this The environment variables configured in ~/.bash_profile are also valid

Related recommendations:php video tutorial

The above is the detailed content of How to change php version under mac. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!