macOS 切换php版本

macOS有自带的php,但是安装了集成开发环境之怎样才能切换到集成开发环境的php版本呢?

1.打开终端输入:

   sudo nano ~/.bash_profile

2.粘贴一下内容到脚本的最后面:

# Setting PATH for MAMP

PATH="/Applications/MAMP/bin/php/你的php版本/bin:$PATH"

export PATH

如图:

macOS 切换php版本_第1张图片
截图

3.然后先按control+o 保存,在按control+x退出。

4.执行:

source .bash_profile

5.which php命令,就已经变成MAMP目录下的PHP版本了

你可能感兴趣的:(macOS 切换php版本)