dongmian8108
dongmian8108
2016-11-15 15:07
浏览 94
已采纳

在mac中升级php时出错

I am running OSX El Capitan (version 10.11.6).

I had php 5.5 installed.

Phpunit requires php5.6 and more so I tried to upgrade my php to 5.6. I couldn't do it so I gave php7 a try.

I followed these guides:
https://coolestguidesontheplanet.com/upgrade-php-on-osx/
https://php-osx.liip.ch/
Mac upgraded PHP to 5.6, but CLI php -v get 5.3.28?

My current output with php -v is :
PHP 7.0.12 (cli) (built: Nov 1 2016 10:21:11) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.12, Copyright (c) 1999-2016, by Zend Technologies with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans

Funny thing, my output with a phpinfo(); when called from somewhere inside a Symfony project, is still PHP Version 5.5.36

Any ideas??

图片转代码服务由CSDN问答提供 功能建议

我正在运行OSX El Capitan(版本10.11.6)。

我安装了php 5.5。

Phpunit需要php5.6等等,所以我尝试将我的php升级到5.6。 我不能这样做所以我试试了php7。

我遵循了这些指南:
https://coolestguidesontheplanet.com/upgrade-php-on-osx/
https://php-osx.liip.ch/
Mac将PHP升级到5.6,但CLI php -v获得5.3.28?

php -v 的当前输出是:
PHP 7.0.12(cli)(内置:2016年11月1日10: 21:11)(NTS) 版权所有(c)1997-2016 PHP Group Zend Engine v3.0.0,版权所有(c)1998-2016 Zend Technologies 与Zend OPcache v7.0.12,版权所有(c)1999-2016 ,Zend Technologies 与Xdebug v2.4.1,版权所有(c)2002-2016,作者:Derick Rethans

有趣的是,我的输出带有 从Symfony项目中的某个地方调用时,phpinfo(); 是stil l PHP Version 5.5.36

任何想法??

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doson1998
    doson1998 2016-11-15 16:13
    已采纳

    Terminal uses a different PHP than a HTTP server in browser. You can check what PHP you're using in CLI (command line interface) by this terminal command:

    $ which php
    

    I don't know if you use any AMP stack (like MAMP). They include their own PHP, so you need to update them in order to have a different PHP version in browser.

    Maybe you can use this trick to determine what PHP versions you use in browser / CLI: Find the php.ini path in your phpinfo() output and compare it with this terminal command:

    $ php -i | grep php.ini
    
    点赞 评论
  • douqihua6212
    douqihua6212 2016-11-15 17:08

    It's always a good idea to use the debug URL to troubleshoot your Symfony projects; to use this, simply append:

    app_dev.php
    

    For example if your route was like http://myhome/, then you would use:

    http://myhome/app_dev.php
    

    Then on the bottom of your browser you will have the Symfony debug bar. In the bottom right corner, the version of Symofny is shown, an if you move your mouse over it, you will see the version of PHP; plus also a link to "View phpinfo()". You can click on it to view the full PHP information, including where the PHP file is located.

    The PHP config file used (shown on the phpinfo() page) is shown by:

    Loaded Configuration File
    

    Hope that helps!

    点赞 评论

相关推荐