composer如何检查php版本?
我只是想知道作曲家在检查需求时如何检查要使用的 php.我使用 MacOS 和终端类型:
I just wondering how composer check which php to use when check for requirements. I use MacOS and in terminal type:
composer require phpunit/phpunit
结果是这样的:
Problem 1
- phpunit/phpunit 5.0.4 requires php >=5.6 -> your PHP version (5.5.27) or "config.platform.php" value does not satisfy that requirement....
当我检查 php 版本时:
When I check php version:
php -v
结果是:
PHP 5.6.10 (cli)(构建时间:2015 年 6 月 12 日 14:08:56)版权所有 (c) 1997-2015PHP Group Zend Engine v2.6.0,版权所有 (c) 1998-2015 Zend技术使用 Xdebug v2.2.5,版权所有 (c) 2002-2014,由 Derick Rethans 提供
PHP 5.6.10 (cli) (built: Jun 12 2015 14:08:56) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
这是:
which php
php:别名为/Applications/MAMP/bin/php/php5.6.10/bin/php
php: aliased to /Applications/MAMP/bin/php/php5.6.10/bin/php
谁能解释一下.提前致谢!
Can someone explain this. Thanks in advance!
推荐答案
Composer 可以告诉你它运行的 PHP 版本,如果你指定 debug verbosity -vvv
.
Composer can tell you what version of PHP it's running on, if you specify debug verbosity -vvv
.
我喜欢用 about
命令运行它,因为输出相对较短.
I like to run it with the about
command, since the output is relatively short.
composer -vvv about
示例输出:
...在 Darwin/18.6.0 上使用 PHP 7.3.5 运行 1.8.5 (2019-04-09 17:46:47)...
... Running 1.8.5 (2019-04-09 17:46:47) with PHP 7.3.5 on Darwin / 18.6.0 ...
这比我预期的更感兴趣,所以这里有一个输出更清晰的版本:
This has gotten more interest than I expected, so here's a version with cleaner output:
composer -vvv about 2>&1 | grep "PHP"
相关文章