Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
906 views
in Technique[技术] by (71.8m points)

macos - Mac upgraded PHP to 5.6, but CLI php -v get 5.3.28?

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.

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

But when I do

$ 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...

Why is that? And how to fix this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you have upgraded using curl, copy & paste the following line of code and press enter.

$ export PATH=/usr/local/php5/bin:$PATH

Now, type $ php -v

If done correctly, it should show the following

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...