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 apache2And then everything worked like intended.
Reference:
- phpinfo() and php -v shows different version of PHP
hakre
187k48 gold badges419 silver badges803 bronze badges
answered Jul 6 at 14:00
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.1and then finally,
sudo service apache2 restartanswered Sep 1 at 22:46
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 apache2also 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 apache2answered 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
1