Docker Community Forums

Share and learn in the Docker community.

Can't load mysqlnd extension in php:fpm-alpine

Hi guys,

Sorry in advance if this is the wrong section!

I’m trying to setup a php image based on php:fpm-alpine.
I want for php to use the mysqlnd extension. Better put: I want the file mysqlnd.so to be in the extension folder /usr/local/lib/php/extensions/no-debug-non-zts-20190902. Somehow this seems to be the folder, where .so-files are stored.

I have an .ini file in the php conf.d folder for enabling the extension:

; configuration for php mysql module
; priority=10
extension=mysqlnd

My Dockerfile looks like this:

FROM php:fpm-alpine

RUN apk update --no-cache \
    && apk add --no-cache $PHPIZE_DEPS \
    && apk add --no-cache php-mysqlnd \
    && docker-php-ext-install mysqlnd \
    && docker-php-ext-enable mysqlnd 

When I try to build the image, it stops with this output (only relevant part):

#5 7.687 fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
#5 7.820 fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
#5 7.980 (1/3) Installing php7-common (7.3.24-r0)
#5 8.000 (2/3) Installing php7-openssl (7.3.24-r0)
#5 8.021 (3/3) Installing php7-mysqlnd (7.3.24-r0)
#5 8.048 OK: 255 MiB in 59 packages
#5 9.541 fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
#5 9.819 fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
#5 10.15 (1/1) Installing .phpize-deps (20201122.190848)
#5 10.16 OK: 255 MiB in 60 packages
#5 10.22 Cannot find config.m4. 
#5 10.22 Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
#5 10.22 
------

Error is basically:
#5 10.22 Cannot find config.m4.
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module

I also created a functioning image without mysqlnd and tried to install it manually from the cli of the cointainer. It didn’t work either.

Help would be highly appreciated.

Please refer https://github.com/docker-library/php/issues/279