Laravel

Laravel – PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version

Ravindra Kumar

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.

How to remove public folder in url in laravel 10, 11 and Above versions

Laravel Page Not Found Error 404 Not Found, but route exist in Laravel

(“SQLSTATE[HY000]: General error: 1005 Can’t create table (errno: 121 “Duplicate key on write or update”)”)

Ravindra Kumar

Ravindra is a passionate full stack developer and dedicated blogger with a flair for crafting user-friendly web applications and insightful articles. With expertise spanning front-end and back-end technologies, Ravindra brings ideas to life through innovative coding solutions.

Suggested Reading

How to Clear Cache in Laravel Without Using Artisan Commands

When working with Laravel, caching plays a key role in improving your application’s performance by storing compiled configurations, routes, views, and other data. However, during development or after making changes, you may need to clear the cache to see your latest updates. Usually, developers use Artisan commands like php artisan cache:clear or php artisan optimize:clear. […]

Upload (restore/import) a MySQL database backup via the command prompt (CLI)

To upload (restore/import) a MySQL database backup via the command prompt (CLI), you can use the mysql command-line utility. Here’s how: You must follow these requirement You must have a MySQL backup file (e.g., backup.sql) MySQL server should be installed and running You should have credentials for the MySQL user If you are working with […]

How to add new column in laravel migration without losing data

To add a new column in a Laravel migration without losing existing data, you can create a new migration file that alters the existing table. Laravel makes this easy using the php artisan make:migration command with the --table option. Step-by-Step Guide: You can generate a new migration Replace column_name with your desired column, and your_table_name […]

imagick php extension must be installed to use this driver in Laravel

It means that your Laravel app (or a package like Intervention Image, Spatie Media Library, or Laravel Snappy) is trying to use the Imagick image processing library, but it’s not installed or enabled on your server. If you’re using Ubuntu/Debian (Linux server): For PHP 8.1+, make sure you’re installing the correct version (e.g., php8.1-imagick). If […]

Attempt to read property “id” on null in Laravel

The error message “Attempt to read property ‘id’ on null” in Laravel typically occurs when you’re trying to access the id property of an object that is null. This commonly happens when you’re expecting an object to be returned (such as a database record), but instead, null is returned. You can handle this null value […]

How to check first record in Laravel blade file

Here’s how to check the first iteration in a Blade @foreach loop: You can use Laravel’s built-in $loop variable: Explanation: {{ $loop->first ? 'active' : '' }}: Adds the active class only to the first item. aria-selected="{{ $loop->first ? 'true' : 'false' }}": Ensures accessibility for tab behavior. Let me know if you also want […]