PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, May 20, 2022

[FIXED] how to add php gd with composer (laravel 8)

 May 20, 2022     composer-php, dompdf, gd, php, require     No comments   

Issue

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

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.



Answered By - Alex Howansky
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing