laravel - Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0"
Get the solution ↓↓↓I have uploaded my laravel project to aws hosting when I go to ip address of ec2 instance it give me this error
Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0".
I check php version current version 7.3 I dont know what actually need to do . First the version was 7.4 then i downgrade it to 7.3
Answer
Solution:
Follow this trick
add this line in config object of composer.json file
"platform-check": false
run
php artisan config:cache
then run
composer dump-autoload
in terminal
Answer
Solution:
Project or global composer.json file
{
"config": {
"platform-check": false
}
}
Answer
Solution:
Problem:
Your composer checks the platform requirements (PHP version and loaded extensions) when the autoloader is loaded. If you run the application which does not meet the platform requirements, the application will exit with a message similar to this:
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 tocomposer install/composer update
to ignore all platform requirements.
Answer
Solution:
This worked for me:
sudo a2dismod php7.2
sudo a2enmod php7.4
sudo service apache2 restart
Adjustphp7.2
to your current module
Answer
Solution:
If you're like me who had to downgrade the PHP version on your machine (Mac) due to a specific reason and when you runvalet use php --force
, you see the Composer global dependencies require PHP v7.3.0 or higher, then you're in the right place. You can comment out the following three lines temporarily and that shall fix the issue for you when runningvalet use php --force
again.
Path:~/.composer/vendor/composer/platform_check.php
if (!(PHP_VERSION_ID >= 70300)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.3.0". You are running ' . PHP_VERSION . '.';
}
Note: don't forget to uncomment the relevant three lines after you switch to the latest version of PHP.
Answer
Solution:
@Hashmat Waziri's answer is right but if anybody want to use your plate form's version Either Composer require anything, He can set the code depending on his system, in to composer.json file like->
"config": {
"platform": {
"php": "7.1.0"
}
},
Answer
Solution:
Actually, this was the only solution that worked for me:
composer global update
composer dump-autoload
Answer
Solution:
Ignoring is not the right option. What you have to do is upgrading your php version, take into account that by now we already have PHP 8, so with version 7.2 you are far behind.
LINUX USERS Depend on your distros, if you are using a Debian derivative like Ubuntu, use this link guide: https://www.cloudbooklet.com/upgrade-php-version-to-php-7-4-on-ubuntu/ or just google for it and all will be fine.
WINDOWS USERS:
If you are using windows, with Laragon, so all you have to do is download the PHP version that you want from https://www.php.net/downloads.php. Unzip the folder to c:/laragon/bin/php folder and then using Laragon GUI select another version in Menu/php.
If you wish to upgrade the global Windows PHP version, you can use Web Platform Installer https://www.microsoft.com/web/downloads/platform.aspx. This for me was one the easiest way of doing it on windows. For more Information follow these link : https://docs.microsoft.com/en-us/iis/application-frameworks/install-and-configure-php-on-iis/install-and-configure-php
Answer
Solution:
So, having struggled with this very problem ("PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.2.5". You are running 7.1.28") for several hours, and finding that none of the above suggestions worked, I finally discovered that -- at least on FreeBSD systems -- the php module required by Apache is not installed by the main php package (e.g., "php74-7.4.19"), but instead by a different, module-specific package with its own versioning (e.g., "mod_php71-7.1.28"). Executing php -v consults the php package; visiting phpinfo() consults the mod package. The clue to this is to execute pkg info | grep php and examine the results to see which packages you have installed. Obviously you have to adjust the above for the packaging system your system uses.
Answer
Solution:
Having used all of the above-attempted solutions, I have found that the one that works best is the following.
sudo apt-get update
sudo apt install php-xml
sudo apt-get install php-mbstring
sudo reboot
Answer
Solution:
I managed to solve this problem by downloading a newer version of PHP that at the same time was compatible with the version of Apache installed from here!. In the Laragon interface, I saw that the Apache version was "httpd 2.4.35 win64 VC15", so I looked for a version of the php that had this "vc15". I downloaded the "php-7.4.19-Win32-vc15-x64" and selected it in my laragon. In this link you can find how to replace the php version in laragon here!
Answer
Solution:
Same problem downgrading from php 8.0 to 7.2 needed to run an older project.
How i have fixed mine issue:
- Remove the broken dependency (installed previously with php 8)
- Unlink the newest php version then link the older php version (i have used brew CLI to link/unlink
$brew link [email protected]
, but i think you can use any php manager app to move to older version of php without any problem) - Then reinstall the dependency
This fixed my problem and allow me to switch between different version without further problems, only requirement is use:
$ composer global update
after switching php version to refresh global dependencies.
No clue about what caused the issue, maybe something went funny during php version switch, but we weren't able to put our finger to the cause of the trouble.
P.S. Our problem was related to "laravel/install" package, uninstalling it required uninstall "laravel/valet" before, procedure isn't changed though, simply we have to reinstall both packages on [email protected]
Answer
Solution:
First of all, read the warning! It says do not run composer as root! Secondly, you're probably using XAMPP on your local which has the required PHP libraries as default. But in your server you're missing ext-dom. php-xml has all the related packages you need. So, you can install it by running:
sudo apt-get update
sudo apt install php-xml
Most likely you are missing mbstring too. If you get the error, install this package as well with:
sudo apt-get install php-mbstring
Then run: composer update
Then run: to reload you apache server
sudo systemctl reload apache2
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: fastcgi sent in stderr: "primary script unknown" while reading response header from upstream
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.