My default php version is php 7.3, i have installed 8.0 and 8.1 as well.
Im using php version 8.1 with a website using below code and its working for me.
<FilesMatch .php$>
SetHandler “proxy:unix:/run/php/php8.1-fpm.sock|fcgi://localhost”
But when i try to use PHP artisan command im getting this error:
PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies
require a PHP version “>= 8.1.0”. You are running 7.3.33-1+0~20211119.91+debian10~1.gbp618351. in
/path/vendor/composer/platform_check.php on line 24
I already used many commands below to fix it but i can’t.
composer config platform.php 8.1
/usr/bin/php8.1 /usr/local/bin/composer update
php8.1 /usr/local/bin/composer
composer config platform.php 8.1
“config”: {
“platform”: {
“php”: “8.1”
}
}
its been a day but i didn’t get any solution.
I tried root@domain:/home/{user}# /usr/bin/php8.1 /home/{user}/.composer/composer
and error below
Could not open input file: /home/{ajmalsarim}/.composer/composer
In the cli PHP cli version only 8.0 showing
Yes i used without {} and the same error,
Could not open input file: /home/username/.composer/composer
with this command.
sudo update-alternatives --list php
showing
with
v-list-sys-php
showing
also i tried with php 8.0
root@domain:/home/user# /usr/bin/php8.0 /home/user/.composer/composer
still same error.
Could not open input file: /home/username/.composer/composer
and here root@domain:/usr/bin# ls
but when im going to my web directory, and run this command php artisan this is the error
root@domain:/home/user/web/domain.com# php artisan
Composer detected issues in your platform:
Your Composer dependencies require a PHP version “>= 8.1.0”. You are running 7.3.33-1+1+debian10~1.51.
PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 8.1.0”. You are running 7.3.+1+debian10~1.g1. in /home/user/web/domain.com/vendor/composer/platform_check.php on line 24
I searched a lot but didn’t get any solution.