thecodingmachine / docker-images-php

A set of PHP Docker images
MIT License
768 stars 137 forks source link

Missing "gd" PHP extension #381

Closed mbrodala closed 4 months ago

mbrodala commented 5 months ago

Expected Behavior

When setting PHP_EXTENSIONS=gd or PHP_EXTENSION_GD=1 I expect the gd extension to be enabled. And in addition to all PHP extensions enabled by default.

Current Behavior

Example php -m execution to check the list of PHP extensions/modules when trying to enable gd via PHP_EXTENSIONS=gd:

7.4-v4-fpm-node12@sha256:9c9760211dec18f29b903ec939a51ded1447e889666bf61b557c4a5af6ac9257 & PHP_EXTENSIONS=gd ``` $ docker run --rm --env PHP_EXTENSIONS=gd thecodingmachine/php:7.4-v4-fpm-node12@sha256:9c9760211dec18f29b903ec939a51ded1447e889666bf61b557c4a5af6ac9257 php -m Invalid extension name found in PHP_EXTENSIONS environment variable. Found: 'gd'. Available extensions: amqp, apcu, ast, bcmath, blackfire, bz2, calendar, ctype, curl, dba, dom, ds, enchant, ev, event, exif, ffi, fileinfo, ftp, generated_conf, gettext, gmp, gnupg, grpc, iconv, igbinary, imagick, imap, intl, json, ldap, mailparse, mbstring, memcached, mongodb, msgpack, mysqli, mysqlnd, opcache, pcov, pdo, pdo_dblib, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phar, posix, pspell, rdkafka, readline, redis, shmop, simplexml, snmp, soap, sockets, sqlite3, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, uuid, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, yaml, zip. [PHP Modules] calendar Core ctype curl date dom exif fileinfo filter ftp gettext hash iconv json libxml mbstring openssl pcntl pcre PDO Phar posix readline Reflection session shmop SimpleXML sockets sodium SPL standard sysvmsg sysvsem sysvshm tokenizer xml xmlreader xmlwriter xsl Zend OPcache zlib [Zend Modules] Zend OPcache ```

Notice the error message which claims that gd does not exist. Also notice that additionally the zip extension is suddenly missing.

Similarly when using PHP_EXTENSION_GD=1 instead, even without error message:

7.4-v4-fpm-node12@sha256:9c9760211dec18f29b903ec939a51ded1447e889666bf61b557c4a5af6ac9257 & PHP_EXTENSION_GD=1 ``` $ docker run --rm --env PHP_EXTENSION_GD=1 thecodingmachine/php:7.4-v4-fpm-node12@sha256:9c9760211dec18f29b903ec939a51ded1447e889666bf61b557c4a5af6ac9257 php -m [PHP Modules] apcu calendar Core ctype curl date dom exif fileinfo filter ftp gettext hash iconv igbinary json libxml mbstring mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql Phar posix readline redis Reflection session shmop SimpleXML soap sockets sodium SPL standard sysvmsg sysvsem sysvshm tokenizer xml xmlreader xmlwriter xsl Zend OPcache zip zlib [Zend Modules] Zend OPcache ```

However, with a previous image version this works just fine:

7.4-v4-fpm-node12@sha256:2c8d0c0a44f932137d381951dbcdddeb8b80b7d200e25d4dcf4973ea8dde1e85 & PHP_EXTENSIONS=gd ``` $ docker run --rm --env PHP_EXTENSIONS=gd thecodingmachine/php:7.4-v4-fpm-node12@sha256:2c8d0c0a44f932137d381951dbcdddeb8b80b7d200e25d4dcf4973ea8dde1e85 php -m [PHP Modules] apcu calendar Core ctype curl date dom exif fileinfo filter ftp gd gettext hash iconv igbinary json libxml mbstring mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql Phar posix readline redis Reflection session shmop SimpleXML soap sockets sodium SPL standard sysvmsg sysvsem sysvshm tokenizer xml xmlreader xmlwriter xsl Zend OPcache zip zlib [Zend Modules] Zend OPcache ```
7.4-v4-fpm-node12@sha256:2c8d0c0a44f932137d381951dbcdddeb8b80b7d200e25d4dcf4973ea8dde1e85 & PHP_EXTENSION_GD=1 ``` $ docker run --rm --env PHP_EXTENSION_GD=1 thecodingmachine/php:7.4-v4-fpm-node12@sha256:2c8d0c0a44f932137d381951dbcdddeb8b80b7d200e25d4dcf4973ea8dde1e85 php -m [PHP Modules] apcu calendar Core ctype curl date dom exif fileinfo filter ftp gd gettext hash iconv igbinary json libxml mbstring mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql Phar posix readline redis Reflection session shmop SimpleXML soap sockets sodium SPL standard sysvmsg sysvsem sysvshm tokenizer xml xmlreader xmlwriter xsl Zend OPcache zip zlib [Zend Modules] Zend OPcache ```

Also works with the newest PHP/Node image at the time of this writing:

8.3-v4-fpm-node20@sha256:9293158688b95337fa9b62da866dee514471f1aae7e68329e9b45216ee2edf8d & PHP_EXTENSIONS=gd ``` $ docker run --rm --env PHP_EXTENSIONS=gd thecodingmachine/php:8.3-v4-fpm-node20@sha256:9293158688b95337fa9b62da866dee514471f1aae7e68329e9b45216ee2edf8d php -m [PHP Modules] apcu calendar Core ctype curl date dom exif fileinfo filter ftp gd gettext hash iconv igbinary json libxml mbstring mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql Phar posix random readline redis Reflection session shmop SimpleXML soap sockets sodium SPL standard sysvmsg sysvsem sysvshm tokenizer xml xmlreader xmlwriter xsl Zend OPcache zip zlib [Zend Modules] Zend OPcache ```
8.3-v4-fpm-node20@sha256:9293158688b95337fa9b62da866dee514471f1aae7e68329e9b45216ee2edf8d & PHP_EXTENSION_GD=1 ``` $ docker run --rm --env PHP_EXTENSION_GD=1 thecodingmachine/php:8.3-v4-fpm-node20@sha256:9293158688b95337fa9b62da866dee514471f1aae7e68329e9b45216ee2edf8d php -m [PHP Modules] apcu calendar Core ctype curl date dom exif fileinfo filter ftp gd gettext hash iconv igbinary json libxml mbstring mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql Phar posix random readline redis Reflection session shmop SimpleXML soap sockets sodium SPL standard sysvmsg sysvsem sysvshm tokenizer xml xmlreader xmlwriter xsl Zend OPcache zip zlib [Zend Modules] Zend OPcache ```

Possible Solution

None, pin the image to the sha256 hash of the previous version.

Steps to Reproduce (for bugs)

See above.

Context

We must enable gd for TYPO3 projects which did work just fine so far.

Your Environment

mbrodala commented 5 months ago

There is indeed no gd.ini in /etc/php/7.4/mods-available/:

Listing /etc/php/7.4/mods-available/ ``` $ docker run --rm thecodingmachine/php:7.4-v4-fpm-node12@sha256:9c9760211dec18f29b903ec939a51ded1447e889666bf61b557c4a5af6ac9257 ls -l /etc/php/7.4/mods-available/ total 292 -rw-r--r-- 1 root root 54 Nov 25 13:04 amqp.ini -rw-r--r-- 1 root root 18 Nov 25 13:05 apcu.ini -rw-r--r-- 1 root root 17 Nov 25 13:08 ast.ini -rw-r--r-- 1 root root 72 Sep 2 08:03 bcmath.ini -rw-r--r-- 1 root root 22 Jan 28 04:59 blackfire.ini -rw-r--r-- 1 root root 66 Sep 2 08:03 bz2.ini -rw-r--r-- 1 root root 74 Sep 2 08:03 calendar.ini -rw-r--r-- 1 root root 71 Sep 2 08:03 ctype.ini -rw-r--r-- 1 root root 68 Sep 2 08:03 curl.ini -rw-r--r-- 1 root root 66 Sep 2 08:03 dba.ini -rw-r--r-- 1 root root 66 Sep 2 08:03 dom.ini -rw-r--r-- 1 root root 30 Nov 25 14:49 ds.ini -rw-r--r-- 1 root root 74 Sep 2 08:03 enchant.ini -rw-r--r-- 1 root root 16 Jan 28 04:59 ev.ini -rw-r--r-- 1 root root 19 Jan 28 05:00 event.ini -rw-r--r-- 1 root root 70 Sep 2 08:03 exif.ini -rw-r--r-- 1 root root 69 Sep 2 08:03 ffi.ini -rw-r--r-- 1 root root 74 Sep 2 08:03 fileinfo.ini -rw-r--r-- 1 root root 69 Sep 2 08:03 ftp.ini -rw-r--r-- 1 root root 0 Jan 31 08:44 generated_conf.ini -rw-r--r-- 1 root root 73 Sep 2 08:03 gettext.ini -rw-r--r-- 1 root root 66 Sep 2 08:03 gmp.ini -rw-r--r-- 1 root root 19 Nov 25 13:16 gnupg.ini -rw-r--r-- 1 root root 32 Nov 25 17:31 grpc.ini -rw-r--r-- 1 root root 71 Sep 2 08:03 iconv.ini -rw-r--r-- 1 root root 364 Dec 2 17:33 igbinary.ini -rw-r--r-- 1 root root 60 Nov 25 13:01 imagick.ini -rw-r--r-- 1 root root 68 Sep 2 08:03 imap.ini -rw-r--r-- 1 root root 68 Sep 2 08:03 intl.ini -rw-r--r-- 1 root root 68 Sep 2 08:03 json.ini -rw-r--r-- 1 root root 68 Sep 2 08:03 ldap.ini -rw-r--r-- 1 root root 37 Nov 25 13:24 mailparse.ini -rw-r--r-- 1 root root 76 Sep 2 08:03 mbstring.ini -rw-r--r-- 1 root root 176 Nov 25 14:21 memcached.ini -rw-r--r-- 1 root root 21 Nov 25 13:31 mongodb.ini -rw-r--r-- 1 root root 74 Jul 6 2022 msgpack.ini -rw-r--r-- 1 root root 71 Sep 2 08:03 mysqli.ini -rw-r--r-- 1 root root 72 Sep 2 08:03 mysqlnd.ini -rw-r--r-- 1 root root 79 Sep 2 08:03 opcache.ini -rw-r--r-- 1 root root 18 Nov 25 13:37 pcov.ini -rw-r--r-- 1 root root 69 Sep 2 08:03 pdo.ini -rw-r--r-- 1 root root 75 Sep 2 08:03 pdo_dblib.ini -rw-r--r-- 1 root root 74 Sep 2 08:03 pdo_mysql.ini -rw-r--r-- 1 root root 74 Sep 2 08:03 pdo_pgsql.ini -rw-r--r-- 1 root root 77 Sep 2 08:03 pdo_sqlite.ini -rw-r--r-- 1 root root 70 Sep 2 08:03 pgsql.ini -rw-r--r-- 1 root root 70 Sep 2 08:03 phar.ini -rw-r--r-- 1 root root 71 Sep 2 08:03 posix.ini -rw-r--r-- 1 root root 72 Sep 2 08:03 pspell.ini -rw-r--r-- 1 root root 21 Jan 28 05:01 rdkafka.ini -rw-r--r-- 1 root root 76 Sep 2 08:03 readline.ini -rw-r--r-- 1 root root 19 Nov 25 14:24 redis.ini -rw-r--r-- 1 root root 71 Sep 2 08:03 shmop.ini -rw-r--r-- 1 root root 72 Sep 2 08:03 simplexml.ini -rw-r--r-- 1 root root 68 Sep 2 08:03 snmp.ini -rw-r--r-- 1 root root 68 Sep 2 08:03 soap.ini -rw-r--r-- 1 root root 73 Sep 2 08:03 sockets.ini -rw-r--r-- 1 root root 74 Sep 2 08:03 sqlite3.ini -rw-r--r-- 1 root root 20 Jan 28 05:04 swoole.ini -rw-r--r-- 1 root root 73 Sep 2 08:03 sysvmsg.ini -rw-r--r-- 1 root root 73 Sep 2 08:03 sysvsem.ini -rw-r--r-- 1 root root 73 Sep 2 08:03 sysvshm.ini -rw-r--r-- 1 root root 68 Sep 2 08:03 tidy.ini -rw-r--r-- 1 root root 75 Sep 2 08:03 tokenizer.ini -rw-r--r-- 1 root root 28 Nov 25 14:04 uploadprogress.ini -rw-r--r-- 1 root root 18 Nov 25 14:04 uuid.ini -rw-r--r-- 1 root root 25 Jun 12 2023 xdebug.ini -rw-r--r-- 1 root root 66 Sep 2 08:03 xml.ini -rw-r--r-- 1 root root 72 Sep 2 08:03 xmlreader.ini -rw-r--r-- 1 root root 72 Sep 2 08:03 xmlrpc.ini -rw-r--r-- 1 root root 72 Sep 2 08:03 xmlwriter.ini -rw-r--r-- 1 root root 66 Sep 2 08:03 xsl.ini -rw-r--r-- 1 root root 18 Jun 12 2023 yaml.ini -rw-r--r-- 1 root root 66 Sep 2 08:03 zip.ini ```
mistraloz commented 4 months ago

I did not understand whats happened. I rebuild without any related changes... and it's working. Maybe a trouble with apt ? I am not sure about that. I hope that will not happens again.

To verify : for V in '7.2' '7.3' '7.4' '8.0' '8.1' '8.2' '8.3'; do for D in 'apache' 'fpm' 'cli' 'apache-node20'; do echo -ne "\nPHP $V ($D) : "; docker run --pull always -q --rm -e "PHP_EXTENSIONS=gd" -ti "docker.io/thecodingmachine/php:$V-v4-$D" php -m | grep -E --color=none "(redis|gd)" | tr -s '\r\n' ' '; done; done;

mbrodala commented 4 months ago

Thanks, seems to be fixed with thecodingmachine/php:7.4-v4-fpm-node12@sha256:591f5c3d7428523a21e86741f31ddd94a1cc5d8e587c9f4a8548bd7312b5be18. :+1: