Skip to main content
Published on December 3, 2026 Installing PHP 8.6 on a Linux VPS does not mean replacing the version you run today. PHP-FPM can run two versions side by side: each site picks its own through its socket, and rolling back is a one-line change. PHP 8.6.0 was released on November 19, 2026. PHP 8.2, meanwhile, gets no more security fixes from the PHP project after December 31, 2026. And this autumn’s vulnerabilities, such as php2shell, were a reminder of what a maintained branch is worth. This guide is for a Debian, Ubuntu, AlmaLinux or Rocky Linux VPS running nginx or Apache with PHP-FPM. The examples start from PHP 8.2 and the site 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:
Good result: each site points to a socket whose version you know, for example /run/php/php8.2-fpm.sock on Debian and Ubuntu, /run/php-fpm/www.sock on AlmaLinux and Rocky Linux.
Debian, Ubuntu: a vhost that uses /run/php/php-fpm.sock, with no number, will change version by itself. That link follows the highest version whose service is running. Replace it with the numbered socket of your current version and reload the web server before installing PHP 8.6.

Check your code against PHP 8.6

With Composer, ask which packages refuse PHP 8.6:
The changes most likely to affect a site, from the PHP 8.6 migration guide and the UPGRADING file: 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 the ondrej/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:
Otherwise, add the repository. These steps follow the official script in README.txt:
The 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:
Then install PHP 8.6 with the common extensions:
The service is called 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. The php: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.
Apache: pin each site’s version first. The php86-php-fpm package drops /etc/httpd/conf.d/php86-php.conf, which sends .php files to PHP 8.6 server-wide from the next httpd reload. A setting inside a <VirtualHost> takes precedence: before installing, add the <FilesMatch> block from the Apache section below to each vhost, with the current socket /run/php-fpm/www.sock.
With nginx, open /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.
The socket is /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 no php8.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:
Good result: no < 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:
Then check your code’s syntax with the new binary, without touching the live site:
Good result: no 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 the www 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:
Test, then reload:
Create the pools for all your sites before the first switch. You will not have to reload PHP-FPM 8.6 again while it serves visitors.

Switch a single site to PHP 8.6

Start with your least critical site. Only one line changes: the socket.

With nginx

On AlmaLinux and Rocky Linux, the line becomes fastcgi_pass unix:/var/opt/remi/php86/run/php-fpm/www.sock;. The old one is often fastcgi_pass php-fpm;.

With Apache

On AlmaLinux and Rocky Linux, the socket is /var/opt/remi/php86/run/php-fpm/www.sock.
A reload is not a restart: requests in progress finish with the old configuration, the next ones go to PHP 8.6. The old PHP-FPM keeps serving the other sites.
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:
Good result: 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:
Deprecations do not show up there: the packaged 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:
The old PHP-FPM never stopped running: the site returns to it as soon as the web server reloads. Fix the code or the missing extension, then try again.

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:
Good result: only commented lines and files shipped by the PHP packages themselves remain. With Apache on Debian and Ubuntu, also check whether the old version’s global configuration is enabled. Once every PHP site has its own <FilesMatch> block, disable it:
Stop the service first, without uninstalling anything. It is your last safety net:
If all is well, uninstall. Read the list of packages to be removed before confirming:
On AlmaLinux and Rocky Linux, the 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

Have a question about a server hosted with us? Our team is available from your client area.