'how to add php gd with composer (laravel 8) [duplicate]
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.
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alex Howansky |
