Composer使用了错误的php版本,但是php -v显示了正确的版本(Ubuntu) [英] Composer uses wrong php version, but php -v shows the correct one (Ubuntu)

查看:299
本文介绍了Composer使用了错误的php版本,但是php -v显示了正确的版本(Ubuntu)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装我的作曲家软件包,但这给了我

I'm trying to install my composer packages, but it gives me this:

该软件包需要php> = 7.0.0但是您的PHP版本(5.5.9)

但是 php -v 给了我这: PHP 7.0.22-0ubuntu0.16.04.1(cli)(NTS)

我正在运行Ubuntu 16.04.3 LTS机器,我发现Mac和Windows有一些问题,但是Linux上似乎没有人遇到这个问题?

I am running an Ubuntu 16.04.3 LTS machine, I found some soultions for Mac and Windows, but nobody seems to have the issue on Linux?

推荐答案

尝试一下:

composer install --ignore-platform-reqs

或在composer.json中的

or this in composer.json

"config": {
    "preferred-install": "dist",
    "platform": {
        "php": "7.0.0"
    }
}

在第二种解决方案中,基本上您是在伪造平台,然后运行 composer.phar update 之后

in the second solution basically you're faking a platform, and run composer.phar update after this

这篇关于Composer使用了错误的php版本,但是php -v显示了正确的版本(Ubuntu)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆