Composer detected issues in your platform: your composer dependencies require a php version >= 8.1 0

I am getting this error with Laravel 9, I have PHP 8.1.7 installed

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

I can see other have asked the question, bit non of the solutions seem to be working

asked Jul 3 at 12:50

3

I had the same problem and it was because I configured a version of PHP 8.1 on the command-line while I kept the PHP module at 8.0.

So PHP_VERSION_ID gave me 80020, while php -v gave me 8.1.7.

It reminded me to reconfigure the PHP Module to PHP version 8.1:

sudo a2dismod php8.0

sudo a2enmod php8.1

sudo systemctl restart apache2

And then everything worked like intended.

Reference:

  • phpinfo() and php -v shows different version of PHP

Composer detected issues in your platform: your composer dependencies require a php version >= 8.1 0

hakre

187k48 gold badges419 silver badges803 bronze badges

answered Jul 6 at 14:00

Composer detected issues in your platform: your composer dependencies require a php version >= 8.1 0

eirieleiriel

1012 bronze badges

1

TIPS

Add this lines in composer.json file:

{
    "config": {

        "platform-check": false
    }
}

Or set the version:

{
    "config": {

        "platform": {
            "php": "7.1.0"
        }
    }
}

And run composer dump-autoload

answered Aug 31 at 11:32

Your Composer dependencies require a PHP version ">= 8.1.0"

I had this same issue while I downgraded my php to v7.4 from 8.1. I somehow messed up with php7.4-fpm mod. However, when I again tried to upgrade my php v8.1 composer started to complain about that error. I simply removed my both php versions that's 7.4 and 8.1 and re-installed only 8.1, which fixed my issue.

To remove, here are the steps I followed....

sudo apt-get purge php8.*
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php8.1

and then finally,

sudo service apache2 restart 

answered Sep 1 at 22:46

Composer detected issues in your platform: your composer dependencies require a php version >= 8.1 0

HumayunHumayun

9567 silver badges13 bronze badges

If @eril answer did not help you by disabling old PHP version

sudo a2dismod php8.0
sudo a2enmod php8.1
sudo systemctl restart apache2

also check composer using a correct version of PHP

composer -vvv about 2>&1 | grep "PHP"

if composer about already shows a correct version of PHP,then check to see the real PHP binary path that composer is using by putting PHP_BINARY inside vendor/composer/platform_check.php like this:

if (!(PHP_VERSION_ID >= 80100)) {
    $issues[] = 'You are running ' . PHP_VERSION . ' located at: ' . PHP_BINARY;
}

in my case, an old version of php-fpm was enabled.

a2disconf php8.0-fpm 
a2enconf php8.1-fpm 
sudo systemctl restart apache2

answered Sep 16 at 23:17

osyanosyan

1,6662 gold badges24 silver badges50 bronze badges

It's just until I find how to solve it but it's working So that's what i've done :

  • download php 8.1.9 (nts)
  • extract it in bin/php/ (i use Laragon)
  • move php 7.14.19 in a new folder(just for preventing)
  • and rename my php 8 folder to php 7 folder name
  • it's still working

Just find the php folder of your server

answered Aug 30 at 0:56

Composer detected issues in your platform: your composer dependencies require a php version >= 8.1 0

1

How fix composer detected issues in your platform your composer dependencies require a PHP version >= 8.1 0?

To Solve Composer detected issues in your platform: Your Composer dependencies require a PHP version Error You Just need to install composer with ignore platform check and it will ignore platform and then your error will be solved.

How do you solve composer detected issues in your platform your composer dependencies require a PHP version UNK 7.3 0?

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3. 0". Solution: You could use the easiest way: add --ignore-platform-reqs option to composer install/composer update to ignore all platform requirements.

Which PHP version is used by composer?

In my case, both of these use my default php script (which is version 7.4). So, while the 7.2 version is used to run Composer, the scripts called by Composer use the default command. Actually, what the platform option is important for is resolving the requirements, so you should add it (in your project composer. json).

How do I update dependency composer?

Updating dependencies to their latest versions# To update to the latest versions, use the update command. This will fetch the latest matching versions (according to your composer. json file) and update the lock file with the new versions.