Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Dockerfile-linux.template
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
env.variant == "zts" # only needed for ZTS builds
and is_alpine
and IN(rcVersion; "8.2")
;
def install_pear_pecl:
# https://github.com/docker-library/php/issues/1554
IN(rcVersion; "8.2", "8.3", "8.4", "8.5")
-}}
FROM {{ env.from }}

Expand Down Expand Up @@ -280,7 +284,7 @@ RUN set -eux; \
# https://github.com/docker-library/php/issues/888
"linux-headers",
# oniguruma is part of mbstring in php 7.4+
"oniguruma-dev"
if install_pear_pecl then "oniguruma-dev" else empty end
else
# debian packages
if env.variant == "apache" then "apache2-dev" else empty end,
Expand All @@ -293,7 +297,7 @@ RUN set -eux; \
"libxml2-dev",
"zlib1g-dev",
# oniguruma is part of mbstring in php 7.4+
"libonig-dev"
if install_pear_pecl then "libonig-dev" else empty end
end ] | sort[] | (
-}}
{{ . }} \
Expand Down Expand Up @@ -350,8 +354,10 @@ RUN set -eux; \
# https://github.com/docker-library/php/issues/822
--with-pic \
\
{{ if install_pear_pecl then ( -}}
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The major justification to compile in mbstring was to support pecl installed packages that depend on it. Our line is to only include extensions that must be compiled into php itself versus what can be added after while following upstream recommendations. So, I agree with this change to drop mbstring in 8.6+.

If they still need it, users can add docker-php-ext-install mbstring in PHP 8.6 and above.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For anyone also surprised with this change, and maybe experiencing this error after running docker-php-ext-install mbstring:

2.309 checking for oniguruma... no
2.313 configure: error: Package requirements (oniguruma) were not met:
2.313
2.313 Package 'oniguruma', required by 'virtual:world', not found
2.313
2.313 Consider adjusting the PKG_CONFIG_PATH environment variable if you
2.313 installed software in a non-standard prefix.
2.313
2.313 Alternatively, you may set the environment variables ONIG_CFLAGS
2.313 and ONIG_LIBS to avoid the need to call pkg-config.
2.313 See the pkg-config man page for more details.

Remember to install libonig-dev on Debian-based images, and oniguruma-dev on Alpine.

@jnoordsij jnoordsij Aug 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or alternatively call docker-php-ext-configure mbstring --disable-mbregex if you don't use it, given its deprecation in PHP 8.6.

{{ ) else "" end -}}
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash
Expand All @@ -377,9 +383,11 @@ RUN set -eux; \
--disable-phpdbg \
{{ ) end -}}
\
{{ if install_pear_pecl then ( -}}
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear")
--with-pear \
\
{{ ) else "" end -}}
{{ if rcVersion | IN("8.2") then ( -}}
# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+)
# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c
Expand Down Expand Up @@ -476,10 +484,12 @@ RUN set -eux; \
{{ clean_apt }}; \
{{ ) end -}}
\
{{ if install_pear_pecl then ( -}}
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
\
{{ ) else "" end -}}
# smoke test
php --version

Expand Down
Loading