我使用的是最新版本的MAMP服务器.
在PHP版本的MAMP设置中,我可以找到最新版本7.1.1,
但是当我运行PHP -v时,我会这样 –
在PHP版本的MAMP设置中,我可以找到最新版本7.1.1,
但是当我运行PHP -v时,我会这样 –
PHP 5.5.14 (cli) (built: Sep 9 2014 19:09:25) copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0,copyright (c) 1998-2014 Zend Technologies
我无法升级它.请帮我.
在MAMP / bin / PHP /中没有像PHP5.5.14这样的文件夹
那是因为它指的是你OSX的预装PHP.您需要将其更改为指向您的MAMP PHP.为此,您需要使用文本编辑器编辑.bash_profile,并将MAMP版本的PHP添加到PATH变量中.
请遵循以下步骤(source):
- Within the Terminal,run
vim ~/.bash_profile
- Type i and then paste the following at the top of the file:
export PATH=/Applications/MAMP/bin/PHP/PHP7.1.1/bin:$PATH
Hit ESC,Type
:wq
,and hit EnterIn Terminal,run:
source ~/.bash_profile
- In Terminal,type in which PHP again and look for the updated string.
If everything was successful,It should output the new path to MAMP
PHP install.
如果它没有输出正确的路径,请尝试关闭终端窗口(完全退出)并再次打开,它应该应用更改.