Php: GD Extension compiles without JPEG Support

Created on 28 Aug 2019  路  6Comments  路  Source: docker-library/php

When I put docker-php-ext-install gd in the Dockerfile extending php:7.3.8-cli, the result is that the extension is compiled without support for JPEG.

The result when calling var_dump(gd_info()) on PHP shipped with MacOS:

  ["GD Version"]=>
  string(26) "bundled (2.1.0 compatible)"
  ["FreeType Support"]=>
  bool(false)
  ["GIF Read Support"]=>
  bool(true)
  ["GIF Create Support"]=>
  bool(true)
  ["JPEG Support"]=>
  bool(true)
  ["PNG Support"]=>
  bool(true)
  ["WBMP Support"]=>
  bool(true)
  ["XPM Support"]=>
  bool(false)
  ["XBM Support"]=>
  bool(true)
  ["WebP Support"]=>
  bool(false)
  ["BMP Support"]=>
  bool(true)
  ["JIS-mapped Japanese Font Support"]=>
  bool(false)
}

The result from the docker version:

array(12) {
  ["GD Version"]=>
  string(26) "bundled (2.1.0 compatible)"
  ["FreeType Support"]=>
  bool(false)
  ["GIF Read Support"]=>
  bool(true)
  ["GIF Create Support"]=>
  bool(true)
  ["JPEG Support"]=>
  bool(false)
  ["PNG Support"]=>
  bool(true)
  ["WBMP Support"]=>
  bool(true)
  ["XPM Support"]=>
  bool(false)
  ["XBM Support"]=>
  bool(true)
  ["WebP Support"]=>
  bool(false)
  ["BMP Support"]=>
  bool(true)
  ["JIS-mapped Japanese Font Support"]=>
  bool(false)
}

Most helpful comment

For those new (like me) to configuring PHP extensions, make sure you run the configuration command before you install the extension itself.

# first configure the to-be-installed extension
RUN docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr

# Only then install it
RUN docker-php-ext-install gd

All 6 comments

This is somewhat expected; see https://github.com/docker-library/wordpress/blob/1283fde76747fe5992e714b782b01a65e9973a47/Dockerfile-debian.template#L16 for an example (docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr).

Ah, right. Thanks. I guess this is not a bug then. :P

I'm now getting this issue with PHP 7.4

I have the --with-jpeg-dir=/usr option but still no jpeg support in gd

I have tried with both libjpeg62-turbo-dev and libjpeg-dev, both produce the same result.

php -i from 7.4

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
GIF Read Support => enabled
GIF Create Support => enabled
PNG Support => enabled
libPNG Version => 1.6.36
WBMP Support => enabled
XBM Support => enabled
BMP Support => enabled
TGA Read Support => enabled

php -i from 7.3

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.9.1
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
libJPEG Version => 6b
PNG Support => enabled
libPNG Version => 1.6.36
WBMP Support => enabled
XBM Support => enabled

Looks like gd isn't liking the options

RUN docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr \
  && docker-php-ext-install -j "$(nproc)" gd
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
configure: WARNING: unrecognized options: --with-freetype-dir, --with-jpeg-dir, --with-png-dir

I've created a new issue #912

For those new (like me) to configuring PHP extensions, make sure you run the configuration command before you install the extension itself.

# first configure the to-be-installed extension
RUN docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr

# Only then install it
RUN docker-php-ext-install gd
Was this page helpful?
0 / 5 - 0 ratings

Related issues

cmath10 picture cmath10  路  3Comments

mbates picture mbates  路  3Comments

dhoeric picture dhoeric  路  4Comments

ihorsamusenko picture ihorsamusenko  路  4Comments

2Kable picture 2Kable  路  3Comments