Mac将PHP升级到5.6,但CLI php -v获得5.3.28? [英] Mac upgraded PHP to 5.6, but CLI php -v get 5.3.28?
问题描述
我在我的机器上安装了MAMP(自带PHP 5.5)。而localhost指向/ Applications / MAMP / htdocs。当我试图在终端中使用composer在htdocs中安装依赖项时,问题发生。 Composer抱怨PHP必须是5.4或更高版本。
I have installed MAMP (comes with PHP 5.5) on my machine. And localhost pointed to /Applications/MAMP/htdocs. The problem happened when I was trying to use composer in terminal to install dependencies in htdocs. Composer complained that PHP must be 5.4 or above.
我猜它抱怨PHP自带的OSX。所以我已通过
I guess it complained about PHP comes with OSX. So I have upgraded PHP to 5.6 by
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
但是当我做
$ php -v
>
I still get
PHP 5.3.28 (cli) (built: Aug 29 2014 18:52:17)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
并且作曲家仍在抱怨...
And Composer is still complaining...
为什么?
推荐答案
如果你已经使用curl,copy&粘贴以下代码行并按回车。
If you have upgraded using curl, copy & paste the following line of code and press enter.
$ export PATH = / usr / local / php5 / bin:$ PATH
$ export PATH=/usr/local/php5/bin:$PATH
现在,键入
$ php -v
Now, type $ php -v
如果正确,应显示以下
PHP 5.6.23(cli)(内置:Jun 26 2016 13:17:47)
版权所有(c)1997-2016 PHP集团
Zend Engine v2.6.0,版权所有c)1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev,版权所有(c)1999-2016,由Zend Technologies提供
with Xdebug v2.2.5,版权所有(c)2002-2014, Derick Rethans
PHP 5.6.23 (cli) (built: Jun 26 2016 13:17:47) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
这篇关于Mac将PHP升级到5.6,但CLI php -v获得5.3.28?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!