Home  >  Article  >  Backend Development  >  How to change php version under mac

How to change php version under mac

王林
王林Original
2021-06-10 16:15:103320browse

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

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

Finally save and reload the environment variable

source ~/.bash_profile

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!

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