example.com: adapt them.
Which PHP versions are still supported?
php.net schedule, checked on December 3, 2026:These dates are the PHP project’s. A distribution may backport fixes to its own packages on its own schedule: check where your PHP comes from before drawing conclusions.
Find the PHP version each site uses
php -v reports the command-line version, not the one behind your sites. Look for the running PHP-FPM services and the socket in each vhost:
/run/php/php8.2-fpm.sock on Debian and Ubuntu, /run/php-fpm/www.sock on AlmaLinux and Rocky Linux.
Check your code against PHP 8.6
With Composer, ask which packages refuse PHP 8.6:
If you are coming from PHP 8.2, the 8.3, 8.4 and 8.5 guides apply too: the changes add up.
WordPress. As of December 3, 2026, the official compatibility table stops at PHP 8.5, supported since WordPress 6.9 (labelled beta support at the time). PHP 8.6 is not listed yet. For a WordPress site leaving PHP 8.2, aim for a version in the table, 8.4 or 8.5: the method in this guide is the same, with that version’s packages.
Install PHP 8.6 alongside your current version
Take a snapshot of the VPS before adding a repository.Debian and Ubuntu: the packages.sury.org repository
The packages.sury.org/php repository ships PHP 8.6 for Debian 13 and 12, and for Ubuntu 26.04, 24.04 and 22.04 LTS. Its packages are built to coexist, one directory per version. Already using theondrej/php PPA on Ubuntu 24.04 or 22.04? It is frozen and no longer receives updates. Migrate with its maintainer’s procedure, which removes and downgrades nothing:
README.txt:
php8.6-cli package registers itself as the php command with the highest priority. To keep your cron jobs on the old version during the migration, pin it first:
php8.6-fpm, its socket /run/php/php8.6-fpm.sock. On an Apache server, the package enables nothing by itself: do not run a2enconf php8.6-fpm, which would switch every site without its own setting at once.
AlmaLinux and Rocky Linux 9 and 10: Remi’s php86 packages
Remi’s repository offers two routes. Thephp:remi-8.6 module replaces the system PHP. The php86 collection installs next to it, under /opt/remi/php86: that is the one you want here.
/etc/opt/remi/php86/php-fpm.d/www.conf. The socket is only accessible to apache there: add nginx, or the site will answer 502.
/var/opt/remi/php86/run/php-fpm/www.sock, and the command line is called php86. The php command does not change.
OPcache: nothing to install
Since PHP 8.5, OPcache is built into the binary and always loaded. There is nophp8.6-opcache package to look for. If you carry over an old ini file, remove zend_extension=opcache.so from it: the line triggers a warning.
Compare extensions and settings before switching
One missing extension is enough to cause a 500 error after the switch. Compare the two lists:< line matches an extension your sites need.
PHP 8.6 starts with its own php.ini. List your settings (memory_limit, upload_max_filesize, post_max_size…) and carry them over one by one, without copying the whole old file:
Parse error or Fatal error line. Deprecated lines are not blocking. This check only sees what compilation can detect: also run the project’s test suite with php8.6 if it has one.
Prepare the site’s PHP-FPM pool
If your sites share thewww pool, carry its settings (pm.max_children in particular) over to PHP 8.6’s www.conf.
If a site has its own pool, recreate it with a different socket name:
Switch a single site to PHP 8.6
Start with your least critical site. Only one line changes: the socket.With nginx
fastcgi_pass unix:/var/opt/remi/php86/run/php-fpm/www.sock;. The old one is often fastcgi_pass php-fpm;.
With Apache
/var/opt/remi/php86/run/php-fpm/www.sock.
PHP sessions. On Debian and Ubuntu, both versions store their sessions in
/var/lib/php/sessions by default: your visitors stay logged in. On AlmaLinux and Rocky Linux, php86 uses its own directory, /var/opt/remi/php86/lib/php/session: with file-based sessions, they will have to log in again. Switch at a quiet time.Verify that the site runs PHP 8.6
Drop in a temporary script, query it, delete it:8.6.0 fpm-fcgi, or a later 8.6 release. Behind a CDN, make sure the response does not come from the cache.
Then walk through what matters: login, forms, file upload, a test payment, an admin task. Keep the logs open meanwhile:
php.ini excludes them. To collect them on a staging site, add php_admin_value[error_reporting] = 32767 to its pool.
Roll back to the previous PHP version
Something wrong? Put the old socket back in the vhost, then:Remove the old PHP version
Wait a few days after the last site. Check that nothing uses the old version any more, scheduled tasks included:<FilesMatch> block, disable it:
php command goes away with the old version. Use php86 in your jobs, or install php86-syspaths, which makes the collection the system’s default version.
Common pitfalls
Unnumbered metapackages. In the Sury repository,php, php-fpm and php-cli now depend on PHP 8.6. If they are installed, a plain apt upgrade can bring in 8.6. Always name the version: php8.6-fpm.
The Sury repository also updates your other PHP versions. It publishes branches 8.2 to 8.5. Look at apt list --upgradable before running apt upgrade.
Automatic updates skip third-party repositories. The default unattended-upgrades origins only cover the distribution. Add the deb.sury.org origin, as explained in our automatic updates guide.
A copy of the vhost in sites-enabled. On Debian and Ubuntu, nginx loads everything in that folder, example.com.bak included. Keep your copies elsewhere.
Queue workers. A worker started by Supervisor or systemd uses the php command, not the socket. It changes version when you change its binary and restart it.
Adding up pm.max_children. Two active PHP-FPM services share the same memory. Watch it while they coexist.
Going further
- Snapshots and VPS backup: a restore point before changing version
- Operating systems: the distributions available for your VPS
- php2shell (CVE-2026-109618): why a maintained PHP branch matters
- PHP 8.5 vulnerability (CVE-2026-129474): worth reading if you choose PHP 8.5
- Slow Linux VPS: measure the effect of the change on CPU and memory
- What’s new in PHP 8.6: partial function application,
Time\Duration,clamp(), the polling API

