3

Upon trying to run composer update drupal/core --with-dependencies, I get this error:

➜  docroot git:(core-upgrade) ✗ composer update --with-dependencies        
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested PHP extension ext-gd * is missing from your system. Install or enable PHP's gd extension.

I've never had this error before, why is ext-gd required at all?

Edit:

I am currently doing this:

phpbrew install 7.1.15 +default+iconv+gd

php -m did not show gd as an installed extension. I've been fine for months until now, so, I am not sure if there was some change between 8.3 to 8.5 or possibly Symfony packages that suddenly requires this.

Edit 2:

This looks like it is also related to updating Homebrew/Xcode, as I had to take these additional steps in order to build a new version of PHP:

https://github.com/Homebrew/homebrew-php/issues/4590#issuecomment-346977512

Still does not explain why I suddenly need the gd extension to install or update a module with Composer for Drupal.

1 Answer 1

3

As of 8.5 core now explicitly requires several PHP extensions in composer.json, including gd:

...
"require": {
  "ext-date": "*",
  "ext-dom": "*",
  "ext-filter": "*",
  "ext-gd": "*",
  ...

The requirements match the required extension list in system_requirements, which would theoretically have to have been met for the original installation, and they were the same all the way back to 8.0.x, so it seems likely you did have gd installed when Drupal was installed.

Without gd installed you should also see an error message in the status report telling you it's missing; if you don't see that error, perhaps you have a different php.ini for FPM and CLI, and gd is only enabled for FPM, so it works in web but not the command line.

The relevant issue on drupal.org is here for reference.

3
  • The --ignore-platform-reqs flag should let you get past this as a stopgap, but you may have some weirdness.
    – mpdonadio
    Commented Mar 8, 2018 at 20:30
  • I had to backtrack - the homebrew update definitely hurt. So, I had to install with phpbrew, install gd with it (and Homebrew), then tell phpbrew to enable that extension. Then composer started to work for this project. But this project wasn't installed with composer, it predated that workflow for us. So that could also be a reason.
    – Kevin
    Commented Mar 8, 2018 at 20:51
  • This was entirely from a local development perspective, too. The remote servers work fine.
    – Kevin
    Commented Mar 8, 2018 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.