PHP --version在osX上显示不正确 [英] PHP --version shown incorrectly on osX
问题描述
我已经从自制软件中安装了osX php7,但是当我在shell中键入php --version
或php-fpm --version
时,会得到较旧的版本
I've installed in my osX php7 from homebrew, however when I type in the shell eitherphp --version
or php-fpm --version
I get as result an older version
PHP 5.5.30 (fpm-fcgi) (built: Oct 23 2015 17:22:03)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
PHP 5.5.30 (fpm-fcgi) (built: Oct 23 2015 17:22:03)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
我从外壳中寻找每个php文件或文件夹sudo find / -name "php"
,但没有链接到PHP 5.5
From the shell I looked for every php file or folder sudo find / -name "php"
but nothing linked to PHP 5.5
我该怎么办?
推荐答案
按照Michael的注释编写〜/.bash.profile之后,由于
After creating ~/.bash.profile as written in comments by Michael, I found the solution thanks to change the PHP path to MAMPs PHP
在〜/.bash_profile中,我写道:
In ~/.bash_profile I wrote:
export PATH=/usr/local/Cellar/php70/7.0.2/bin:$PATH
export PATH=/usr/local/Cellar/php70/7.0.2/sbin:$PATH
第一行用于php,第二行用于php-fpm
First row is for php, the second for php-fpm
然后,确保更改在终端source ~/.bash_profile
Then, to be sure that changes take effect type in terminal source ~/.bash_profile
这篇关于PHP --version在osX上显示不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!