Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer uses wrong php version, but php -v shows the correct one (Ubuntu)

Tags:

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

This package requires php >=7.0.0 but your PHP version (5.5.9)

But php -v gives me this: PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )

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?

like image 597
PrimuS Avatar asked Aug 28 '17 07:08

PrimuS


People also ask

How do I update composer to a specific version?

To change to version one run the self-update command and pass in the --1 flag. This will change composer to version one and now you can install your dependencies. Once you have installed your dependencies, now you can run the same command and pass in --2 as the flag and this will switch back to composer version 2.

How do I find my PHP composer version?

Composer can tell you what version of PHP it's running on, if you specify debug verbosity -vvv .


1 Answers

try this:

composer install --ignore-platform-reqs

or this in composer.json

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

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

like image 110
user10089632 Avatar answered Oct 14 '22 13:10

user10089632