1

I've installed GD on Docker machine as described in https://hub.docker.com/_/php/ using:

RUN apt-get update && apt-get install -y \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng12-dev \
    && docker-php-ext-install -j$(nproc) iconv mcrypt \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd

for both PHP 7 and PHP 5.6. It's working without a problem (I can manipulate images) but I want to now install some composer package that requires "ext-gd": "*", and the problem is like this:

php -m 

shows gd loaded but

composer show -p

doesn't show ext-gd so I cannot install package I need using composer. Is there any way to install GD to make Composer see it?

I've found similar issue here: https://github.com/composer/composer/issues/4353 but it was closed without resolving. Also composer dependency stating in dont have php-xsl wasn't solved.

For reference I've verified also Homestead and there composer show -p shows ext-gd without a problem also on my localhost (Windows) it's working.

So the only problem I found is with Docker installation. Do you have any clue how can it be solved?

Community
  • 1
  • 1
Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291

1 Answers1

0

The problem was not directly of Composer but the way I used it.

I had Composer installed in /usr/local/bin/composer but created alias like so:

alias composer="php -n /usr/local/bin/composer"

to not use Xdebug when running composer.

But in fact it was causing all PHP extensions were disabled when running composer so when composer tried to install any package requiring GD2 it didn't see GD2 was installed.

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291