Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ethar's avatar
Level 5

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0".

i uploaded laravel 8 to a shared host, but i got this error

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0".
in composer.json
"require": {
        "php": "^7.3|^8.0",
        "artesaos/seotools": "^0.22.1",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "laravel/framework": "^8.75",
        "laravel/sanctum": "^2.11",
    },

note: i cant upgrade php to 8.1 cause its shared host, but as you see in composer.json its required php 7, not 8

0 likes
17 replies
kokoshneta's avatar

Read the error carefully: your Composer dependencies require PHP 8.1. It’s not your Composer file that requires it, it’s the Composer file in one of your dependencies.

Generally speaking, it’s not a good idea to use shared hosting for Laravel projects. Apart from not being able to control the PHP version, it’s very easy to create a completely insecure app where anyone has access to all your passwords, etc.

1 like
kokoshneta's avatar
Level 27

@ethar It’s not a dependency that Laravel comes with – Laravel 8 on its own runs fine with PHP 8.0. It must be something in an additional package you’ve added, but it may be a dependency required by a dependency required by a dependency in one of those packages.

5 likes
Sinnbeck's avatar

@ethar If someone ran composer update using php8.1 your composer.lock file might be the issue. Try deleting it and see if you can run composer install with php8.0 (locally!)

4 likes
FlowerPower's avatar

See your \vendor\composer\platform_check.php There are parts in Laravel that won't work with lower php version. You can remove or comment out platform chack, but it will make you no good. Best!

Antmans's avatar

I have a solution (not professional but it works)

  • download php 8.1.9 (nts).zip
  • extract it in bin/php/ (i use Laragon)
  • move php 7.14.19 in a new folder(just for preventing futur errors)
  • and rename my php 8 folder to php 7 folder name it's still working Just find the php folder of your server
2 likes
ousid's avatar

If you are operating on nginx server, It's likely the php-fpm8.1 is not active.

Try to:

sudo systemctl status php-fpm8.1.service

Depends on the status of the php-fpm version, you can act, and if it's stopped, you may want to do the following:

sudo systemctl enable php-fpm8.1.service
sudo systemctl start php-fpm8.1.service

Then double-check the status, and if it's active. You're good to go.

Note: This applies to any php-fpm version, not just 8.1.

Hope this help!

1 like
appfinz's avatar

whenever your laravel application load, the composer auto-detects the dependencies, configs, and platform check. you can simply stop checking your application for the platform by using.

composer install --ignore-platform-reqs

or #add to composer.json > config "platform-check": false,

composer autoload-dump

cristisst's avatar

this is a composer thing not a laravel necessary. so in your composer.json file you have

in composer.json
"require": {
        "php": "^7.3|^8.0",

which means you accept any php version greater than 7.3 and 8.0. The trouble is if you have 8.2 on your machine and on the shared server 8.0 and you run composer install on your machine, then you'll see this error because you're setting a constraint to match the php version you run the composer. There're a few ways to fix that:

  1. you remove composer.lock and vendor folder, ftp the code to your shared server, ssh to it and run ```composer install` on the remote machine (shared server)
  2. you change require from ^8.0 to exactly the php version you're using on the shared server without the ^ sign in front and run composer install locally (obviously you remove the composer.lock and vendor folder)
  3. you can specify under config->platform which php version to be used:
"config": {
        "platform": {
            "php": "8.0"
        }
    },

NEVER EVER USE composer update in production. Read about the differences: https://dev.to/ajayyadav/composer-update-vs-composer-install-2na1 Normally once you have the composer.lock and composer.json file, once you run composer install you'll have consistency within the libraries you're using!

1 like
kokoshneta's avatar

which means you accept any php version greater than 7.3 and 8.0. The trouble is if you have 8.2 on your machine and on the shared server 8.0 and you run composer install on your machine, then you'll see this error because you're setting a constraint to match the php version you run the composer.

Not by default, no. ^8.0 includes version 8.2 as well. Specifying PHP the version as ^7.3||^8.0 in your composer.json file can never, on its own, lead to the error that dependencies require 8.1 or higher.

Plus, if – as here – there is a dependency somewhere that does actually require 8.1 or higher, there is no way to fix it if you cannot upgrade the PHP version on the system, which the question says is the case here.

cristisst's avatar

@kokoshneta I have seen that error many times. It's because the machine where it's been ran composer install it's 8.1 hence the composer.lock file locked everything to 8.1 thing which can be checked in both composer.lock file (symfony packages set the require to the php version the composer had ran) and in vendor/composer/platform_check.php file. So if you run composer install on a php version 8.1 or 8.2 and you try to run it on a server running 8.0, the platform_check.php file will be triggered by autoload and it will show you that error. On the other hand, if you run composer install on the server running the 8.0 but in the lock file you have the require to 8.1 for one or more packages you'll get an error that you're running version 8.0 and in the lock the requirement is >=8.1 like this: requires php >=8.2.1 -> your php version (8.0.20) does not satisfy that requirement

NserekoDeo's avatar

In the cpanel under tools, please check out something called php selector. it gives you the option of selecting a php version that you want and "I think" it routes your requests through a serve that has the version or it runs a deamon tool or something of the sort. I had the same error of "Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0" and i played around and it somehow work fine

peuf's avatar

i'm having the same issue and none of the solutions worked. when i ran php -v i found that i had php 8.1.1 on my pc. If i downgrade to php 8.1.0 is there a way / command to reinstall or downgrade composer and all dependencies and packages to php 8.1.0 ?

dwen's avatar

in the composer.json file, add config "platform-check": false, and then run composer dump-autoload it works for me!

1 like

Please or to participate in this conversation.