Closed kamyweb closed 6 months ago
Hey there!
Your problem is caused by the fact that you're accidentally mixing two PHP installation by using apk
to install PHP extensions, as this will actually add an entire new PHP installation to the resulting image, rather than using the bundled one. To install additional extensions to this image, you could use the bundled docker-php-ext-install
script. Given that mbstring
and openssl
are already part of the base image, something along the following lines should work:
FROM php:8.1-fpm-alpine
RUN apk add --no-cache <packages-you-need> && \
docker-php-ext-install -j$(nproc) pdo_mysql && \
php -m # smoketest
See also https://github.com/docker-library/docs/tree/master/php#how-to-install-more-php-extensions if you're looking for additional details.
Unable to build our custom Dockerfile based on php:8.1-fpm-alpine after the upgrade of Alpine to ver. 3.20 Dockerfile:
Error:
Following this link it seems Alpine drop support to php81 on v.3.20, isn't it? https://pkgs.alpinelinux.org/packages?name=*php81*&branch=v3.20&repo=&arch=x86_64&maintainer=
In this case, it makes sense to build a php81 docker image based on distro version that drop support to it?
Temporary solution is using php:8.1-fpm-alpine3.18