docker-library / php

Docker Official Image packaging for PHP
https://php.net
MIT License
3.84k stars 2.01k forks source link

Error to run any of `docker-php-ext~` command #1467

Closed jakubboucek closed 11 months ago

jakubboucek commented 12 months ago

Current versions of image PHP 8.3, 8.2 and 8.1 is unable to run any of docker-php-ext-~ command.

$ docker pull php:cli
cli: Pulling from library/php
Digest: sha256:0490f6f8fe4d442ebcda2604b55f6260831f082a40425f67d91abf4ba78b725b
Status: Downloaded newer image for php:cli
docker.io/library/php:cli

$ docker run --rm -it php:cli bash

root@d62946bf9dc5:/# docker-php-ext-configure
/usr/local/bin/docker-php-ext-configure: 19: cd: can't cd to /usr/src/php/ext

For some reason is expected directory missing. But also when created, script still fails with message the command arguments is invalid. Bad arguments are explicitly pasted from image documentation.

$ docker run --rm -it php:cli bash

root@0d93d5811813:/# mkdir -p /usr/src/php/ext

root@0d93d5811813:/# docker-php-ext-configure gd --with-freetype --with-jpeg
usage: /usr/local/bin/docker-php-ext-configure ext-name [configure flags]
   ie: /usr/local/bin/docker-php-ext-configure gd --with-jpeg-dir=/usr/local/something

Possible values for ext-name:
dirname: missing operand
Try 'dirname --help' for more information.
basename: missing operand
Try 'basename --help' for more information.

Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.

The last note of error message holds an opinion the extension is already configured – it's not true.

It's look the current images are corrupted.

tianon commented 12 months ago

:grimacing: I can't seem to reproduce:

$ docker run -it --rm --pull=always php:cli bash
cli: Pulling from library/php
1f7ce2fa46ab: Already exists 
48824c101c6a: Pull complete 
249ff3a7bbe6: Pull complete 
aa5d47f22b64: Pull complete 
d1e0a99e5dd2: Pull complete 
3bbde62704ed: Pull complete 
0dee93122317: Pull complete 
19ae5fd3e75e: Pull complete 
13d3594087bb: Pull complete 
Digest: sha256:0490f6f8fe4d442ebcda2604b55f6260831f082a40425f67d91abf4ba78b725b
Status: Downloaded newer image for php:cli
root@17415265938b:/# docker-php-ext-configure --help
usage: /usr/local/bin/docker-php-ext-configure ext-name [configure flags]
   ie: /usr/local/bin/docker-php-ext-configure gd --with-jpeg-dir=/usr/local/something

Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dl_test dom enchant exif ffi fileinfo filter ftp gd gettext gmp hash iconv imap intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell random readline reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlwriter xsl zend_test zip

Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.
root@17415265938b:/# docker-php-ext-configure gd --with-freetype --with-jpeg
Configuring for:
PHP Api Version:         20230831
Zend Module Api No:      20230831
Zend Extension Api No:   420230831
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether cc accepts -g... yes
checking for cc option to enable C11 features... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20230831
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for GD support... yes, shared
checking for external libgd... no
checking for libavif... no
checking for libwebp... no
checking for libjpeg... yes
checking for libXpm... no
checking for FreeType 2... yes
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... no
checking for floorf... no
checking for zlib... no
configure: error: Package requirements (zlib) were not met:

Package 'zlib', required by 'virtual:world', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables ZLIB_CFLAGS
and ZLIB_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
LaurentGoderre commented 12 months ago

I also can't reproduce (using multiple architectures)

jakubboucek commented 11 months ago

Uh oh. Thanks for reply and your time. Something wrong was with my Docker Engine. When I pruned it all, the error no more shows.