Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to add php gd with composer (laravel 8)

I trying to add php gd to the composer.json.
I want to install php gd because of the following error :

The PHP GD extension is required, but is not installed.

The error was caused by dompdf as dompdf requires php gd to process images.
I tried the following command :

composer require "ext-gd:*" --ignore-platform-reqs

Without any result even tough ext-gd was added to the composer.json.
Does anyone know a solution to my problem?
Thank in advance.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can’t install GD with Composer. Composer manages other PHP source that your project relies on, but GD is not PHP source — it’s a native PHP extension module like ext-curl or ext-mysqli. Adding ext-gd:* to your composer.json simply means, "This project requires the GD extension to be installed." In order to actually install that extension, you’ll need to drop to your OS-level tools. If you’re on a Debian-based system, that’ll likely be something like:

sudo apt install php-gd

Or, for a RedHat-based system, something like:

sudo dnf install php-gd

Once done, run your composer install again and you should be good.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading