PHP 8.6 Released

PHP 8.6 Released

PHP 8.6 was released in November.

PHP remains the runtime behind a large share of self-hosted software: Nextcloud, WordPress, Nextcloud’s ecosystem, forum software, and a long tail of web applications people run on their own servers.

Check the application before the runtime

The order that matters, and the one people get wrong.

PHP applications specify which PHP versions they support, and running a newer PHP than the application has been tested against is how a working site breaks. Deprecations in a minor release become errors in the next major, and a strict application will refuse to start rather than misbehave quietly, which is the better outcome.

php --version
php -m                          # loaded extensions

# which versions are installed
ls /etc/php/
update-alternatives --list php 2>/dev/null

# what is the web server actually using
php-fpm8.6 -v 2>/dev/null
systemctl status 'php*-fpm'
# Debian and Ubuntu, multiple versions coexist
sudo apt install php8.6-fpm php8.6-cli php8.6-{mysql,gd,curl,mbstring,xml,zip,intl}

Install the extensions your application needs, not a default set. A missing extension is the most common cause of a blank page after an upgrade, and the error lands in the PHP log rather than the web server’s.

The FPM pool is the part worth configuring

; /etc/php/8.6/fpm/pool.d/www.conf
pm = dynamic
pm.max_children = 20
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 6
pm.max_requests = 500
# is the pool exhausted, which presents as a slow site
sudo grep -i 'server reached pm.max_children' /var/log/php8.6-fpm.log

“server reached pm.max_children” is the message to search for when a self-hosted PHP site is intermittently slow. It means requests are queueing for a worker, and no amount of nginx tuning fixes it.

Sizing is memory-bound: pm.max_children multiplied by per-worker memory has to fit in RAM with room left for the database and the page cache. Our memory pressure guide covers what happens when it does not, and the answer is usually the OOM killer choosing MySQL.

Upgrading without breaking the site

# 1. what does the application support
# check its documentation, not its README from 2021

# 2. install alongside, do not replace
sudo apt install php8.6-fpm

# 3. point one vhost at it first
# fastcgi_pass unix:/run/php/php8.6-fpm.sock;

# 4. watch
sudo tail -f /var/log/php8.6-fpm.log /var/log/nginx/error.log

# 5. only then switch the rest

The ability to run multiple PHP versions side by side is the feature that makes this safe. One vhost on the new version, with the old one still available, is a rollback that takes one config line.

Our nginx comparison covers the web server side, our reverse proxies guide covers what sits in front, and our MariaDB guide covers the database underneath, which is the other half of nearly every PHP application’s version matrix.

Version support

PHP maintains active support for two years and security support for a third. Running a version past security end of life on an internet-facing site is a decision with a predictable outcome.

# are you on something still supported
php --version | head -1

Distribution packages frequently lag, and a distribution backporting security fixes to an older PHP is a different thing from upstream support. Both are fine; knowing which one you are relying on is the point.

Background reading

Explainers for the concepts behind this story.