Skip to content
14+ years building on WordPress / Replies in under 5 hours
Maintenance 11 min read · Updated December 2026

How to Upgrade to PHP 8.6 on Ubuntu (and Is WordPress Ready for It?)

Photo of Ajay Khandal
Ajay Khandal
WordPress Developer
Terminal running sudo apt install php8.6 on an Ubuntu server, next to a WordPress logo asking whether WordPress is ready for PHP 8.6
On this page
Key takeaways

PHP 8.6.0 was released on 19 November 2026 and is supported until 31 December 2030. Most live WordPress sites should not switch yet: WordPress 7.1.5 doesn't list PHP 8.6 as compatible, the core team expects WordPress 7.2 to support it, and WooCommerce is tested only up to PHP 8.4.

  • Sites on PHP 8.2 or older should upgrade to 8.4 or 8.5 before 31 December 2026, when 8.2 reaches end of life.
  • On Ubuntu, PHP 8.6 comes from packages.sury.org, because the Ondřej PPA is frozen.
  • Install php8.6-fpm and the WordPress extensions, copy your old php.ini settings, point Nginx or Apache at the PHP 8.6 socket, and keep the old version installed so you can roll back.
  • Test on staging first and watch debug.log for deprecation notices and fatal errors.

Last updated: 3 December 2026. I’ll update this guide when WordPress 7.2 ships and when WooCommerce adds PHP 8.6 to its tested versions.

PHP 8.6.0 came out on 19 November 2026. If you run WordPress on your own Ubuntu server, the upgrade looks a lot like the one from 8.4 to 8.5, with one change that catches people out: the Ondřej Surý PPA that most guides tell you to add is now frozen. This guide shows the new install method, which PHP 8.6 changes can break plugins, and whether a live WordPress site should move to 8.6 yet.

If you are still on PHP 8.4 or older and want the previous step first, my PHP 8.5 upgrade guide for Ubuntu covers that release.

When was PHP 8.6 released, and how long is it supported?

PHP 8.6.0 was released on 19 November 2026, according to the official php.net announcement. It gets active bug-fix support until 31 December 2028 and security fixes until 31 December 2030. PHP 8.2 reaches end of life on 31 December 2026, so sites still on 8.2 need to move this month.

Here is where each current branch stands, taken from the PHP supported versions page:

PHP version Active support until Security fixes until Status in December 2026
8.1 and older Ended Ended End of life, no security fixes
8.2 31 Dec 2024 31 Dec 2026 Security fixes only, end of life this month
8.3 31 Dec 2025 31 Dec 2027 Security fixes only
8.4 31 Dec 2026 31 Dec 2028 Active, moves to security-only in January
8.5 31 Dec 2027 31 Dec 2029 Active
8.6 31 Dec 2028 31 Dec 2030 Active, newest release

The same day 8.6.0 shipped, the PHP team also released 8.5.13, 8.4.28, 8.3.37 and 8.2.36. If you stay on an older branch for now, update to those patch versions at least. PHP 8.6.0 already contains the fixes for the two remote code execution flaws patched in October, which my PHP2Shell guide for WordPress explains.

Is WordPress compatible with PHP 8.6?

Not officially yet. WordPress 7.1.5, the current release, predates PHP 8.6 and the core compatibility table stops at PHP 8.5. In its November PHP chat, the core team wrote that “confidence in PHP 8.6 compatibility in the upcoming WordPress 7.2 release is high.” Plugins are the bigger unknown, and WooCommerce has not listed 8.6 as tested.

Here is what each source says today:

Software PHP 8.6 status (3 December 2026) Source
WordPress 7.1.5 Not listed. The compatibility table covers PHP up to 8.5. WordPress PHP compatibility table
WordPress 7.2 (next major release) Expected to be compatible. A developer note for 8.6 is being drafted. Core PHP chat, November 2026
WordPress recommendation PHP 8.3 or greater WordPress requirements
WooCommerce PHP 8.3 or greater, tested up to PHP 8.4 WooCommerce server requirements

The core team also flagged one concrete break. WordPress used to flip images by passing negative dimensions, “a pattern that broke in 8.6”, and they warn that “plugins that copied the old pattern may still break.” Image editors, thumbnail generators and media plugins are worth testing first.

WordPress dropped the old “beta support” label for new PHP versions in May 2026, so you will not see that wording any more. The practical signal to watch for is a PHP 8.6 row in the compatibility table and a “tested up to” note from your key plugins.

Should you upgrade a live WordPress site to PHP 8.6 now?

For most live WordPress sites, no. Move to PHP 8.4 or 8.5 now, and test 8.6 on a staging copy. Switch production once WordPress 7.2 is out, your main plugins confirm support, and PHP has shipped its first 8.6 patch releases. Sites still on PHP 8.2 or older should upgrade this month regardless.

Your situation What I recommend now
Running PHP 8.2 or older Upgrade before 31 December 2026. Go to 8.4 or 8.5, which WordPress already covers.
Running PHP 8.4 or 8.5, brochure or blog site Stay put. Test 8.6 on staging and switch after WordPress 7.2.
WooCommerce store Stay on 8.4 until WooCommerce lists 8.6 as tested. Checkout failures cost real orders.
Custom theme or plugin you maintain Test on 8.6 now, so the deprecation fixes are ready before your clients upgrade.
Managed host (Kinsta, WP Engine, SiteGround and similar) Wait until the host offers 8.6 in its dashboard, then test with its staging tool.

A store owner should treat the PHP version as part of routine upkeep. My WooCommerce maintenance checklist puts it in the quarterly review, next to plugin and server checks.

What’s new in PHP 8.6?

PHP 8.6 adds partial function application, default values for readonly properties, a built-in clamp() function, a Time\Duration class, a SortDirection enum and a new Io\Poll API for watching many network streams at once. Streams can also throw exceptions instead of warnings. Most of these help developers more than site owners.

The full list is on the PHP 8.6 release page. These are the ones you are most likely to meet in WordPress code.

Partial function application

You can now call a function with some arguments filled in and a ? placeholder for the rest. PHP returns a closure that waits for the missing values. In the RFC, ? stands for exactly one argument and ... for zero or more.

$versions = ['8.3.14', '8.6.0', '8.5.13'];

// Keeps only versions at or above 8.6
$current = array_filter($versions, version_compare(?, '8.6', '>='));

Default values for readonly properties

Readonly properties arrived in PHP 8.1 but could not have a default value. In 8.6, instance readonly properties, including those in readonly classes, can declare one.

final class InvoiceSettings {
    public readonly string $currency = 'USD';
}

The clamp() function

clamp() keeps a value inside a range. It replaces the max($min, min($max, $value)) pattern, a common way to cap a value in PHP code.

clamp(110, 0, 100); // int(100)
clamp(-5, 0, 100);  // int(0)

Smaller additions

  • Time\Duration represents elapsed time, for example Duration::fromSeconds(30).
  • The SortDirection enum gives a shared way to say ascending or descending.
  • Streams can be set to throw a StreamException instead of raising warnings.
  • Function parameters can carry DocComments, and Reflection gains isReadable() and isWritable() on properties.

There is no published benchmark of PHP 8.6 against 8.5 for WordPress yet. Kinsta’s PHP benchmarks were last updated in December 2025 and stop at 8.5, so treat any claim of a big 8.6 speed gain with caution until real tests appear.

Which PHP 8.6 changes can break WordPress plugins and themes?

Most PHP 8.6 changes are deprecations. They write warnings to your error log but keep the site running. The changes that can actually break a page are stricter value checks that now throw a ValueError, new session defaults, and file functions that now return false when writing fails. Older plugins are the usual source of trouble.

These are the changes from the PHP 8.6 migration guide that I would check first in a WordPress codebase:

Change in PHP 8.6 Effect Where it shows up in WordPress
spl_object_hash() deprecated in favour of spl_object_id() Deprecation notice Plugins that track objects or build their own hook IDs
Returning a value from __construct() or __destruct() deprecated Deprecation notice Older plugin classes written before PHP 7
is_long(), is_integer(), is_double() and doubleval() deprecated Deprecation notice Older themes and form or calculation plugins
Third argument to define() deprecated Deprecation notice Old wp-config.php snippets and legacy plugins
Passing an object to array_walk() or http_build_query() deprecated Deprecation notice API and payment gateway integrations that build query strings
Image flipping with negative dimensions no longer works Broken output Image editing and media plugins
Many functions throw ValueError for out-of-range values, bad flags or NUL bytes Fatal error if not caught Any plugin that passes unchecked input to built-in functions
Session defaults: strict mode and HttpOnly on, SameSite set to Lax Changed behaviour Plugins that use native PHP sessions, such as some membership and cart add-ons
fclose(), file_put_contents() and copy() return false when a write fails at close Changed return value Backup, cache and export plugins

If a plugin throws a fatal error after the switch, my guide to finding and fixing plugin conflicts shows how to isolate it quickly. A blank page usually means a fatal error, which the white screen of death guide walks through.

Why does apt say the Ondřej PHP PPA is deprecated?

The Ondřej Surý PPA on Launchpad, ppa:ondrej/php, is frozen. Its page now reads “This PPA is frozen and no longer receives updates” and points to packages.sury.org instead. That is why apt update reports that the PPA’s label changed to “PPA for PHP (deprecated)”. PHP 8.6 packages come only from the new repository.

If your server already uses the old PPA, the PPA page on Launchpad gives these migration commands for Ubuntu 22.04 and 24.04:

sudo apt update
sudo apt install debsuryorg-repository-php
sudo add-apt-repository --remove ppa:ondrej/php
sudo apt update

Leaving the old PPA in place is a quiet security risk. Your PHP packages stop receiving patches, and nothing breaks loudly to tell you.

How do you upgrade to PHP 8.6 on Ubuntu?

Back up the site, add the packages.sury.org repository, install php8.6-fpm with the extensions WordPress needs, copy your old PHP settings across, point Nginx or Apache at PHP 8.6, then test. Keep the old PHP version installed so you can switch back in under a minute. Do the whole run on staging first.

Ubuntu does not ship PHP 8.6 in its own archive. Ubuntu 24.04 LTS includes PHP 8.3 and Ubuntu 26.04 LTS includes PHP 8.5, so 8.6 always comes from the Sury repository. These steps work on 22.04, 24.04 and 26.04. Replace 8.5 in the commands with whatever version you run now.

Step 1: Record your current setup and take a backup

Save a list of your current PHP version, modules and packages, so you can reinstall the same extensions later:

php -v
php -m > ~/php-modules-before.txt
dpkg -l | grep php | awk '{print $2}' > ~/php-packages-before.txt

Then take a full backup of files and database, plus a server snapshot if your host offers one. My WordPress backup guide covers what a restorable backup needs. If you do not have a staging copy yet, set up a WordPress staging site and run every step there first.

Step 2: Add the packages.sury.org repository

On a server that has never used the old PPA, run the setup script from packages.sury.org. It installs the signing key and adds the repository for your Ubuntu release:

curl -sSL https://packages.sury.org/php/README.txt | bash

The script calls sudo itself when you are not root. If you are migrating from the old PPA, use the commands in the previous section instead.

Step 3: Install PHP 8.6 and the WordPress extensions

sudo apt update
sudo apt install php8.6-fpm php8.6-cli php8.6-mysql php8.6-curl php8.6-gd \
  php8.6-imagick php8.6-intl php8.6-mbstring php8.6-xml php8.6-zip php8.6-bcmath

Compare the result with ~/php-modules-before.txt and add anything missing, such as php8.6-redis if you use a Redis object cache. There is no php8.6-opcache package to install, because OPcache has been part of the core PHP build since 8.5.

Step 4: Copy your PHP settings across

PHP 8.6 starts with default settings, so your old memory limit, upload size and FPM pool values do not carry over. Compare the files and copy your changes:

diff /etc/php/8.5/fpm/php.ini /etc/php/8.6/fpm/php.ini
diff /etc/php/8.5/fpm/pool.d/www.conf /etc/php/8.6/fpm/pool.d/www.conf
sudo systemctl restart php8.6-fpm

Step 5: Point your web server at PHP 8.6

For Nginx, change the socket in your site’s server block to fastcgi_pass unix:/run/php/php8.6-fpm.sock; and reload:

sudo nginx -t && sudo systemctl reload nginx

For Apache with PHP-FPM, swap the FPM configuration:

sudo a2enmod proxy_fcgi setenvif
sudo a2disconf php8.5-fpm
sudo a2enconf php8.6-fpm
sudo systemctl reload apache2

For Apache with mod_php, install the module and swap it:

sudo apt install libapache2-mod-php8.6
sudo a2dismod php8.5
sudo a2enmod php8.6
sudo systemctl restart apache2

Step 6: Set PHP 8.6 as the command-line default

WP-CLI and server cron jobs use the command-line PHP, which is separate from the web server. Switch it too:

sudo update-alternatives --set php /usr/bin/php8.6
php -v

Step 7: Test the site and watch the error log

In WordPress, open Tools, then Site Health, then Info, and confirm the Server section shows PHP 8.6. Turn on logging in wp-config.php with WP_DEBUG and WP_DEBUG_LOG set to true and WP_DEBUG_DISPLAY set to false. Then click through the pages that matter: forms, login, search, image uploads and, on a store, a full test order. Check wp-content/debug.log afterwards and look up any plugin that shows fatal errors or a flood of deprecation notices.

Leave the old PHP version installed for at least a week. Once nothing new appears in the log, you can remove it.

How do you roll back if PHP 8.6 breaks your site?

Point the web server back at the old PHP version and reload it. Because the old version is still installed, this takes under a minute and needs no restore. On Nginx, change the socket back to your previous version. On Apache, reverse the a2enconf or a2enmod commands. Then find the failing plugin on staging.

# Nginx: set fastcgi_pass back to unix:/run/php/php8.5-fpm.sock; then
sudo nginx -t && sudo systemctl reload nginx

# Command line
sudo update-alternatives --set php /usr/bin/php8.5

Rolling back only the web server is enough to bring the site back. Switch the command-line default too, so WP-CLI and cron run on the same version as the site.

If you would rather not touch the server yourself, PHP upgrades with staging tests and a rollback plan are part of my WordPress care plans. For the business case behind regular PHP upgrades, see why WordPress sites should keep PHP current.

Frequently asked questions

PHP 8.6.0 is a general availability release, published on 19 November 2026, so it is meant for production use. As of 3 December 2026 no 8.6.1 patch has shipped yet. For a business site, the safer plan is to test now on staging and switch after the first patch releases and WordPress 7.2.

WordPress 7.1.5 is not listed as compatible with PHP 8.6. The official compatibility table currently stops at PHP 8.5. The WordPress core team said in November 2026 that confidence in PHP 8.6 compatibility for the upcoming WordPress 7.2 release is high.

No. The Ondřej Surý PPA on Launchpad is frozen and no longer receives updates, and it has no PHP 8.6 packages. Ubuntu packages are now published at packages.sury.org. Existing PPA users can switch by installing debsuryorg-repository-php and removing the old PPA.

PHP 8.4 or 8.5 is the safe choice for most sites. WordPress recommends PHP 8.3 or greater, and WooCommerce is tested up to PHP 8.4. PHP 8.2 reaches end of life on 31 December 2026, and PHP 8.1 and older no longer receive security fixes.

Nobody has published a WordPress benchmark of PHP 8.6 yet. Kinsta's PHP benchmarks, last updated in December 2025, stop at PHP 8.5. Moving from an end-of-life version such as 8.1 to any current release is the change most likely to give a measurable speed gain.

No. The two critical remote code execution flaws (CVE-2026-109618 and CVE-2026-109619) were fixed in October 2026, and PHP 8.6.0 includes those fixes. On older branches, you need at least 8.5.12, 8.4.27, 8.3.36 or 8.2.35.

Photo of Ajay Khandal

Written by Ajay Khandal

I'm a freelance WordPress developer with 14+ years of experience building, fixing, and speeding up sites for businesses, agencies, and store owners across the US, UK, Europe, and Australia. I specialize in custom themes, WooCommerce, and performance, the kind of work that shows up as faster load times and fewer support tickets. You work directly with me, and replies typically arrive within 5 hours.

Work with me →