Laravel Composer Sees Wrong PHP Version

Laravel Composer sees wrong PHP Version

I've had this problem too. If you don't want to update all your composer packages, you can solve this issue by manually changing the composer.lock file and writing your actual PHP version in platform > php in the JSON object.

Example

...
"platform": {
"php": "7.1"
}
...

Although it works, the most recommended way to do this would be deleting your composer.lock file, changing the platform > php version in composer.json and then executing composer install.

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

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

Laravel - Composer detected issues in your platform after updating it

Your terminal user's PHP version may differ from the server's version.

You may have 7.4.13 on terminal while having a completely different PHP version in apache2 or whatever server you are using.

Use phpinfo(); in a PHP file and access it via browser to see the actual PHP version.

Composer telling the wrong php version

I just realized this config at the bottom of my composer.json:

"config": {
"platform": {
"php": "5.5.9"
}
},

That's the version on which it bases his warning (not the one actually used)



Related Topics



Leave a reply



Submit