PHP 版本错误

PHP version error

在我的 10.9 Mac 上,我通过

安装了 Symfony

"sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony"

"sudo chmod a+x /usr/local/bin/symfony"

我做的时候

"symfony new my_project_name"

它说:

"[RuntimeException]                                                    
  The selected version (3.2.1) cannot be installed because it requires  
  PHP 5.5.9 or higher and your system has PHP 5.4.45 installed."

然后我将 PHP 升级为:

"curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6"

phpinfo 显示 5.6.27。 但是symfony新项目错误一直存在...

CLI says 5.4.45 and the running apache / phpinfo in the browser says 5.6.27

您的 CLI PHP 版本已过时,而 Apache 使用的版本是最新的。

要为它们使用相同的版本,请先通过点击检查 CLI 版本所在的位置

which php

它应该 return 类似于 /usr/bin/php

重命名这个旧版本:

sudo mv /usr/bin/php /usr/bin/php5445

然后创建一个符号link到正确的版本:

sudo ln -s /usr/local/php5/bin/php /usr/bin/php

您必须记住,CLI 和网络服务器的版本是不同的。 这是一个传统问题。