Now Hiring: Are you a driven and motivated 1st Line IT Support Engineer?
  • +91 9546042639
  • Patna - Sitamarhi Rd, near icici bank, Bhagwanpur, Muzaffarpur, Bihar 842001
How to Resolve PHP GD Extension Error in XAMPP

How to Resolve PHP GD Extension Error in XAMPP

If you're working with PHP and XAMPP and encounter the following error when running composer install:

Your lock file does not contain a compatible set of packages. Please run composer update.

Problem 1
  - phpoffice/phpspreadsheet is locked to version 1.29.0 and an update of this package was not requested.
  - phpoffice/phpspreadsheet 1.29.0 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension.
    

It means that the GD extension, which is required by phpoffice/phpspreadsheet, is not enabled in your PHP installation. Here’s how you can resolve this issue.

Step 1: Enable the GD Extension in PHP

Follow these steps to enable the GD extension:

  1. Locate the php.ini file in your XAMPP installation. You can find it at D:\xampp\php\php.ini.
  2. Open the php.ini file in a text editor.
  3. Search for the following line:
  4. ;extension=gd
  5. Uncomment the line by removing the semicolon (;) at the beginning:
  6. extension=gd
  7. Save and close the php.ini file.

Step 2: Restart Apache

To apply the changes, you need to restart Apache:

  • Open the XAMPP Control Panel.
  • Click the Stop button next to Apache.
  • Click the Start button to restart Apache.

Step 3: Verify the GD Extension is Enabled

To ensure that the GD extension is enabled, run the following command in your terminal:

php -m | findstr gd

If the extension is enabled, this command should return gd.

Step 4: Run composer install Again

Finally, you can try running composer install again:

composer install

This should resolve the dependency issues and allow Composer to install the necessary packages.

Conclusion

By enabling the GD extension in PHP, you can easily resolve the issue and continue with your project. If you encounter any further issues, be sure to check your php.ini configuration for any other missing extensions or errors.


Comments

No comments yet.


Add Comment



+91 9546042639