PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 8.0.2”. You are running 7.3.2.
Question :
I am working on a Laravel project and when i made a zip file of this project and uploaded into the web hosting of Linux server and it started to show the following error PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version.
The project is working fine on local host but it is now working on web hosting i am running xampp on my local system.
Answer :
As I am seeing here error is occurred due to PHP version because you have developed your project on PHP Version 8.02
and your web hosting is running on Version 7.3.2
so you need to upgrade either web hosting server’s version or downgrade the project PHP version to 7.3.2
You should install the xampp version 7.3.2
on your PC and configure your project on 7.3.2 version
to make it work on web hosting.
You can downgrade your PHP version by downloading a portable Xampp. from this link
Step 1 : Download and extract it and find the folder name PHP and apache .
Step 2 : Copy these folders and replace these with old xampp’s PHP and apache folders under C:\xampp.
Step 3 : Now Restart the Xampp and check the PHP version .
Other solution
You can upgrade or downgrade your Laravel version. First you need to check your Laravel version, To know your Laravel version you can use artisan command which is php artisan --version
you can run it on terminal or command prompt. You also need to check your php version to do that you can run php -v
on command prompt and after knowing both versions of Laravel and php, you can check the compatibility weather both are compatible or not.
You can also check your Laravel project version into the file called composer.json
which is located under the Laravel project directory. To downgrade or upgrade the laravel project version just change the value of "laravel/framework":
to desired version of laravel which you want to change for your project and after doing these changes into composer.json
file just run the following artisan command which is composer update
If you are developing your project on Laravel, you need to check the php versions because all versions does not support to specific Laravel version.I am going to explain which laravel version is compatible to which php veriosn so you need to read the following steps.
Laravel 4.2 version support to PHP version 5.4 or greater
Laravel 8 version support to PHP version 7 or greater
You can check all version on laravel official website.