PHP 8.6 in Docker: Our Laravel Tests Passed, the Image Build Didn't
We tried PHP 8.6 a week after release. Our code needed no changes, but the official image dropped mbstring and switched to ZTS, two extensions failed to compile and Composer forced a framework update.
We tried PHP 8.6 eight days after its release
PHP 8.6.0 was released on November 19, 2026. DeployWatchers is a Laravel 13 application with a Filament admin, Horizon queues on Redis and a Pest suite of about a thousand tests. It runs on the official php:8.5.13-fpm-alpine image. In our Dockerfile the PHP version is a single build argument:
ARG PHP_VERSION=8.5.13
FROM php:${PHP_VERSION}-fpm-alpine AS base
Changing that line to 8.6.0 looked like the whole upgrade. In a separate lab image, our application code needed no changes at all. Everything around it did:
| Area | What we observed on 8.6.0 |
|---|---|
| Official base image | ZTS build, no mbstring, no pecl |
| phpredis 6.3.0 (latest stable) | Does not compile |
| pcov 1.0.12 (latest tag) | Does not compile |
| Composer platform check | Four locked packages exclude PHP 8.6 |
| Our code and tests | 975 passed, no deprecations, warnings or notices |
None of this touched production. Everything below ran in throwaway Docker images and in a copy of the repository.
The base image changed before our code did
The first build failed before it reached our code. We compared the configure flags of the two official images (php -i | grep "Configure Command"):
- --with-pic
- --enable-mbstring
- --with-pear
+ --enable-zts
+ --disable-zend-signals
A quick check on both tags shows the same difference:
for img in php:8.5.13-fpm-alpine php:8.6.0-fpm-alpine; do
docker run --rm "$img" php -r \
'echo PHP_VERSION, PHP_ZTS ? " ZTS" : " NTS", extension_loaded("mbstring") ? " mbstring" : " no-mbstring", PHP_EOL;'
done
8.5.13 NTS mbstring
8.6.0 ZTS no-mbstring
These changes are intentional on the image maintainers' side, not a broken build:
- PECL is gone. The 8.6 images no longer ship the PECL binary (docker-library/php#1654 (opens in a new tab)). Tools such as
install-php-extensionsstill work because they bring their own installer. - mbstring is no longer compiled in. It had been enabled mainly as a PECL prerequisite. A maintainer confirmed in docker-library/php#1720 (opens in a new tab) that the removal is intentional and that images needing it should install it explicitly.
- The default variants are thread-safe (ZTS).
cli,fpmandapacheare now ZTS for 8.6. After a heated discussion in docker-library/php#1719 (opens in a new tab), a separatentsvariant was added on November 25 (#1722 (opens in a new tab)). It is a CLI variant: when we checked, tags such as8.6-nts-alpineexisted, while no NTS FPM tag did.
The missing mbstring hurt the most. symfony/polyfill-mbstring was installed, but it does not provide every function. Without the extension, even php artisan about stopped:
Error
Call to undefined function Termwind\ValueObjects\mb_strimwidth()
The fix is one word in the extension list:
RUN install-php-extensions pdo_mysql mbstring redis intl zip bcmath pcntl opcache gd exif sockets
ZTS needs more thought. We are not claiming it is slower or unsafe for PHP-FPM. Benchmarks posted in the discussion show differences of a few percent on most workloads, with larger ones under JIT. But it is a runtime mode change that a docker pull of a floating tag such as 8-fpm delivers silently. A binary-only extension built for NTS will not load. Put php -v in your build log: it prints (ZTS) or (NTS).
Two extensions did not compile
PHP 8.6 removed several old engine macros that extensions used to read INI settings. From UPGRADING.INTERNALS in the 8.6.0 source:
The INI_STR(), INI_INT(), INI_FLT(), and INI_BOOL() macros have been removed.
The XtOffsetOf() alias of C's offsetof() macro has been removed.
Two extensions in our image still used them in their latest releases:
redis 6.3.0: error: implicit declaration of function 'INI_INT'
pcov 1.0.12: error: implicit declaration of function 'INI_BOOL'; did you mean 'ZEND_BOOL'?
Both projects already had fixes, just not in stable releases:
- phpredis published
6.4.0RC1on November 23. It compiled on 8.6.0 withinstall-php-extensions redis-6.4.0RC1. - pcov merged its 8.6 build fix into
developon November 24 (krakjoe/pcov#134 (opens in a new tab)), but there was no tagged release yet. Installing it from the GitHub branch withinstall-php-extensions krakjoe/pcov@developfailed for an unrelated reason: the installer could not find apackage.xml. We compiled it from a pinned commit instead:
ARG PCOV_REF=3795c08561d69ca7f55f693492de59a65a6a182d
RUN apk add --no-cache --virtual .build $PHPIZE_DEPS \
&& mkdir /tmp/pcov && cd /tmp/pcov \
&& curl -fsSL "https://codeload.github.com/krakjoe/pcov/tar.gz/${PCOV_REF}" | tar xz --strip-components=1 \
&& phpize && ./configure --enable-pcov && make -j"$(nproc)" && make install \
&& docker-php-ext-enable pcov \
&& apk del .build && rm -rf /tmp/pcov
That is fine for a lab. We would not ship a release candidate of the Redis client behind our queues, or an untagged coverage driver in CI, without a reason more urgent than "the new PHP is out".
Composer said no, and the fix was not small
With the extensions in place, composer check-platform-reqs failed. composer why-not lists every package that blocks a PHP version:
composer why-not php 8.6.0
nette/php-generator v4.2.2 requires php (8.1 - 8.5)
nette/schema v1.3.6 requires php (8.1 - 8.5)
nette/utils v4.1.5 requires php (8.2 - 8.5)
openspout/openspout v4.32.0 requires php (~8.3.0 || ~8.4.0 || ~8.5.0)
These are Filament dependencies, not ours, and newer releases already allow 8.6. Updating only nette/php-generator was refused, because Filament 5.11 pinned the old openspout. Allowing Filament and its dependencies to move resolved it:
composer update nette/php-generator 'filament/*' openspout/openspout -W
That one command changed 67 locked packages, including Filament 5.11 → 5.12, Livewire 4.4.8 → 4.4.10 and Laravel 13.42 → 13.44. After it, two tests failed. They expected a specific Livewire exception when a request tampers with a locked Filament property, and received a different one.
This was not caused by PHP 8.6. On PHP 8.5 with our current lock file, the suite passed with no failures. On PHP 8.5 with the updated lock file, the same two tests failed in the same way. The failures came with the dependency update, and PHP 8.6 only forced us to make it.
That is the most useful lesson of the experiment. A PHP upgrade can hide a framework upgrade, and their failures look alike in CI. We will ship the dependency update on PHP 8.5 first, fix those tests, and only then change the runtime.
What the test suite said about PHP 8.6 itself
With mbstring installed and the updated dependencies, the lab image ran:
| Check | Result on 8.6.0 |
|---|---|
pest --parallel |
975 passed, 1 skipped, 2 failed (same as on 8.5 with the same lock) |
pest --display-deprecations --display-warnings --display-notices |
None reported |
| Laravel cache, queue push and lock on a real Redis 8 container (phpredis 6.4.0RC1) | Worked |
| Coverage with pcov from the pinned commit | Worked |
php-fpm -t with our pool config |
Configuration test successful |
One small behaviour change showed up in warning text. PHP 8.6 makes the display of function arguments in error messages consistent and controlled by a new INI option, error_include_args, which is off by default (RFC (opens in a new tab)). As a result, a failed file_get_contents() no longer includes the path:
PHP 8.5: file_get_contents(/nope): Failed to open stream: No such file or directory
PHP 8.6: file_get_contents(): Failed to open stream: No such file or directory
If you search logs or match error strings in tests, this will change what you see.
These checks have limits. The suite runs in the CLI on in-memory SQLite, with external I/O faked. It does not exercise PHP-FPM under real traffic, a MySQL connection pool, long-running Horizon workers or OPcache behaviour in production. We have not load-tested ZTS FPM, and the PHP 8.6 numbers above are from our suite, not a benchmark.
Our plan, and a checklist you can reuse
We are staying on PHP 8.5 for now. It receives active support until the end of 2027, so there is no pressure. The upgrade will happen in three separate steps, each deployed and observed on its own:
- Update Filament and its dependencies on PHP 8.5, fix the two locked-property tests, ship.
- Wait for stable phpredis 6.4.0 and a tagged pcov release.
- Switch the image to PHP 8.6 with
mbstringadded, deploy to the test environment first, then to production through the normal blue-green release.
If you are trying 8.6 in Docker this week, these checks found every issue we hit:
# Inside the candidate image:
php -v # ZTS or NTS?
php -m | grep -E '^(mbstring|redis|pcov)$'
composer why-not php 8.6.0 # which locked packages block it
composer check-platform-reqs
vendor/bin/pest --display-deprecations --display-warnings --display-notices
Run the same tests on your current PHP version with the updated lock file. If they fail there too, the problem came with the dependency update, not with PHP.
Catch problems after your next deployment
Monitor availability, browser JavaScript errors and visual changes with DeployWatchers.