composer如何检查php版本?

How composer check php version?(composer如何检查php版本?)
本文介绍了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"

这篇关于composer如何检查php版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)