Extension gd is missing from your system - laravel composer Update
Stefan Izdrail
Founder & Senior Architect · 2026-06-29
Title: Extension gd is missing from your system - Laravel Composer Update solved
Body:
The error message "Problem 1 - dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is missing from your system" typically occurs when you attempt to install a package using Laravel's Composer, such as DomPDF, and it relies on another extension that isn't presently installed on your system.
In this case, "dompdf/dompdf v0.7.0 requires ext-gd" suggests that the GD (Graphics Direct Library) PHP extension is missing from your current setup. This issue is often encountered when installing or updating packages via Composer, as it's a common dependency error.
Solving this problem
1. Firstly, you need to install the GD library on your system. For Linux users, you can run the following command in your terminal:sudo apt-get install php5-gd. This should install PHP-GD along with other necessary modules for graphics manipulation. In case of CentOS/Fedora, use the respective package manager to install these packages.
2. After installing the extension, ensure that the required extensions are enabled in your configuration files by running: php --ini. This will display the list of ini files used in CLI mode. Check that gd is listed amongst the other extensions and confirm if they're properly enabled.
3. If you find issues with the GD library, you might need to edit your configuration files (depending on your OS) such as:
- /etc/php/5.6/cli/php.ini
- /etc/php/5.6/cli/conf.d/10-opcache.ini
- ... (the list of conf.d directories may vary depending on your PHP version or install)
4. Open the configuration files and locate the section related to PHP extensions:
extension=gd.so
extension=curl.so
extension=imagick.so
Ensure that these lines are uncommented (by removing the leading semicolon ';' if present). Save the file and restart your Apache server or command line environment to apply the changes.
5. If you are using Docker, ensure your PHP image contains the gd extension. Run docker ps -a to list all running containers. Locate your PHP image container ID and stop it with:
docker stop [container_id]. Once stopped, remove the container: docker rm [container_id]. Create a new Dockerfile based on the latest official PHP images for your desired PHP version and include the gd extension. Build your custom image using this Dockerfile: docker build -t my-php-image .. After building, create a new container from your image: docker run --name php_container -p 80:80 -v $PWD:/var/www -e APACHE_RUN_MOD_REWRITE=true -e TZ=Europe/London -d my-php-image. This will launch your PHP container with the gd extension.
6. Ensure all other required extensions needed for DomPDF are installed and enabled. For a comprehensive list of required extensions and their installation instructions, refer to the official DomPDF documentation: https://laravelcompany.com/docs/dompdf.
7. Finally, you should check if any other packages or extensions might interfere with each other and cause conflicts. If possible, remove conflicting libraries or use alternative solutions for your current issue. It's crucial to ensure that all dependencies are compatible with your system configuration.
Remember to always keep a backup before making changes in your server environment. This will allow you to revert any unforeseen issues or unexpected consequences caused by modifications made during this process. Once the error is resolved, update your composer and packages to ensure your project remains up-to-date and secure from potential vulnerabilities or conflicts.
In conclusion, solving the "gd extension missing" error requires identifying and installing the needed PHP extensions for your system environment. Following the aforementioned steps should assist you in resolving this issue and using DomPDF, as well as other packages, without further problems. Always refer to official package documentation and maintain a stable development setup to ensure project success.