Mac 将 PHP 升级到 5.6,但是 CLI php -v 得到 5.3.28?

Mac upgraded PHP to 5.6, but CLI php -v get 5.3.28?(Mac 将 PHP 升级到 5.6,但是 CLI php -v 得到 5.3.28?)
本文介绍了Mac 将 PHP 升级到 5.6,但是 CLI php -v 得到 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

我还是得到了

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

Composer 还在抱怨……

And Composer is still complaining...

这是为什么呢?以及如何解决这个问题?

Why is that? And how to fix this?

推荐答案

如果你已经使用 curl 升级,复制 &粘贴以下代码行并回车.

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

如果操作正确,它应该显示以下内容

If done correctly, it should show the following

PHP 5.6.23 (cli)(构建时间:2016 年 6 月 26 日 13:17:47)版权所有 (c) 1997-2016 PHP 集团Zend Engine v2.6.0,版权所有 (c) 1998-2016 Zend TechnologiesZend OPcache v7.0.6-dev,版权所有 (c) 1999-2016,Zend Technologies使用 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)