Skip to content
Advertisement

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

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?

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement