← Back to Blog

PHP 8.6: New Features, What Breaks and How to Upgrade (Tested on 8.6.0)

Published · by Leo Gashi, RS Computers

PHP Debian 13 Docker

PHP 8.6.0 was released on 19 November 2026 and is the current stable PHP branch, with active support until 31 December 2028 and security fixes until 31 December 2030. The headline features are partial function application, a Time\Duration class, the Io\Poll API, clamp(), a SortDirection enum and default values for readonly properties, and the change most likely to surprise an existing site is that three session settings are now secure by default.

This guide runs each feature on real PHP 8.6.0, lists what is deprecated or behaves differently, and shows how to get 8.6 on Debian 13, Ubuntu and Docker without touching the PHP your sites already use. To try it on a clean machine, any of our VPS or VDS servers in Amsterdam, Dublin or Prishtina comes with full root, so every command below works as written.

Quick answer: start new projects on PHP 8.6. For a production site on Debian 13, stay on the distribution's PHP 8.4 for now, install 8.6 next to it from packages.sury.org (apt-get install php8.6-fpm php8.6-cli after adding the repository), run your test suite there, and switch one site at a time. In Docker, change the tag to php:8.6-fpm in a branch and run your tests.

Key facts, checked 22 November 2026:

PHP 8.6 release date and support timeline

PHP's policy, in its own words: "Each release branch of PHP is fully supported for two years from its initial stable release", followed by two more years of critical security fixes. These are the dates on php.net's supported versions page:

BranchReleasedActive support untilSecurity fixes until
PHP 8.619 Nov 202631 Dec 202831 Dec 2030
PHP 8.520 Nov 202531 Dec 202731 Dec 2029
PHP 8.421 Nov 202431 Dec 202631 Dec 2028
PHP 8.323 Nov 2023ended 31 Dec 202531 Dec 2027
PHP 8.28 Dec 2022ended 31 Dec 202431 Dec 2026

There is no LTS release of PHP. The closest thing is a distribution package: Debian 13 ships PHP 8.4 and patches it through its own security archive, which is why 8.4 on Debian is a calm place for a production site to wait.

How we tested

We used a fresh Debian 13.7 container (8 CPU threads, 2 GB RAM) on 22 November 2026. It had Debian's own php8.4 8.4.28-1~deb13u1 and, next to it, php8.6 8.6.0-3+debsuryorg13.1+1 from packages.sury.org. php8.6 -v printed PHP 8.6.0 (cli) (built: Nov 20 2026 15:05:50) (NTS). Docker 26.1.5 inside the same container ran the official php:8.6-cli and php:8.6-fpm-alpine images. Every output below comes from that machine.

PHP 8.6 new features, each one run on 8.6.0

Partial function application

Put ? where an argument is still missing and PHP gives you a Closure that waits for it. Nothing is called until the last argument arrives (RFC).

<?php
$versions = ['8.4', '8.5', '8.6'];
$isNew = version_compare(?, '8.6', '>=');
print_r(array_filter($versions, $isNew));

function price(float $net, float $vat, string $cur) { return round($net * (1 + $vat), 2) . " $cur"; }
$withVat = price(?, 0.18, 'EUR');
echo $withVat(100), "\n";
Array
(
    [2] => 8.6
)
118 EUR

The same file on PHP 8.4 stops with Parse error: syntax error, unexpected token "?".

Time\Duration

A value object for elapsed time with nanosecond precision, so a timeout no longer travels through your code as a bare integer that might be seconds or milliseconds (RFC).

<?php
use Time\Duration;
$timeout = Duration::fromSeconds(1)->add(Duration::fromMilliseconds(100)->multiplyBy(2 ** 3));
var_dump($timeout->seconds, $timeout->nanoseconds);
var_dump($timeout < Duration::fromSeconds(30));
int(1)
int(800000000)
bool(true)

clamp()

Keeps a value inside a range, replacing the old max($min, min($value, $max)) puzzle (RFC).

<?php
var_dump(clamp(-10, 0, 100));
var_dump(clamp(110, min: 0, max: 100));
try { clamp(5, 10, 0); } catch (ValueError $e) { echo $e->getMessage(), "\n"; }
int(0)
int(100)
clamp(): Argument #2 ($min) must be smaller than or equal to argument #3 ($max)

SortDirection enum

One built-in type for "ascending or descending", so libraries stop inventing their own strings and integers (RFC).

<?php
function orderBy(string $col, SortDirection $dir = SortDirection::Ascending): string {
    return $col . ' ' . match ($dir) {
        SortDirection::Ascending => 'ASC',
        SortDirection::Descending => 'DESC',
    };
}
echo orderBy('name', SortDirection::Descending), "\n";
try { echo orderBy('name', SORT_DESC); } catch (TypeError $e) { echo $e->getMessage(), "\n"; }
name DESC
orderBy(): Argument #2 ($dir) must be of type SortDirection, int given, ...

Readonly property defaults

A readonly property can now have a default value instead of a constructor line (RFC).

<?php
final readonly class Plan {
    public string $disk = 'NVMe';
    public function __construct(public int $vcpu) {}
}
$p = new Plan(4);
echo $p->disk, " ", $p->vcpu, "\n";
try { $p->disk = 'HDD'; } catch (Error $e) { echo $e->getMessage(), "\n"; }
NVMe 4
Cannot modify readonly property Plan::$disk

On PHP 8.4 the same class fails with Fatal error: Readonly property Plan::$disk cannot have default value.

Stream errors as exceptions

File and network functions can throw a StreamException with a structured error instead of a warning you have to silence with @ (RFC).

<?php
$ctx = stream_context_create(['stream' => ['error_mode' => StreamErrorMode::Exception]]);
try {
    file_get_contents('/etc/app/config.json', context: $ctx);
} catch (StreamException $e) {
    foreach ($e->getErrors() as $err) {
        echo $err->code->name, " | ", $err->wrapperName, " | ", $err->message, "\n";
    }
}
OpenFailed | plainfile | Failed to open stream: No such file or directory

Io\Poll

A polling API on top of epoll, kqueue and similar system calls, meant as a base for event loops such as ReactPHP and AMPHP, without the connection limits of stream_select() (RFC). On our Linux container it picked epoll:

<?php
use Io\Poll\{Context, Event};
[$a, $b] = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, 0);
$poll = new Context();
$poll->add(new StreamPollHandle($b), [Event::Read]);
fwrite($a, "ping");
foreach ($poll->wait() as $watcher) {
    echo fread($watcher->getHandle()->getStream(), 100), "\n";
}
var_dump($poll->getBackend());
ping
enum(Io\Poll\Backend::Epoll)

Smaller additions for tools and libraries

Parameters can carry their own doc comments (RFC), and ReflectionProperty::isReadable() and isWritable() say whether a property can be used from a given scope (RFC): for a public private(set) property our test printed isReadable=yes isWritable=no. JSON errors now carry a position: json_last_error_msg() returned Syntax error near location 1:9 on 8.6 and only Syntax error on 8.4.

What breaks: session defaults and other behaviour changes

These come from the official UPGRADING file for PHP 8.6.0, section 1. The one to read twice is sessions. UPGRADING says "session.use_strict_mode is now 1 (was 0)", "session.cookie_httponly is now 1 (was 0)" and "session.cookie_samesite is now "Lax" (was unset)". We compared the two FPM builds on the same machine:

for v in 8.4 8.6; do echo "PHP $v:"; php-fpm$v -i | grep -E "^session\.(use_strict_mode|cookie_httponly|cookie_samesite) "; done
PHP 8.4:
session.cookie_httponly => Off => Off
session.cookie_samesite => no value => no value
session.use_strict_mode => Off => Off
PHP 8.6:
session.cookie_httponly => On => On
session.cookie_samesite => Lax => Lax
session.use_strict_mode => On => On

For most sites this is a free security gain. It can break three things: JavaScript that reads the session cookie, a login that depends on the session cookie arriving with a cross-site POST (some payment and single sign-on return pages work this way), and custom session handlers that accept IDs they never created. UPGRADING tells such applications to set the old value explicitly.

Other changes worth a grep through your code:

PHP 8.6 deprecations you will meet first

Deprecations do not stop your code. They write notices to the log and tell you what a later major version may remove. We ran the common ones on 8.6.0 with error_reporting=-1:

Deprecated: Returning from a finally block is deprecated in /root/t/fin.php on line 2
Deprecated: Returning a value from a constructor is deprecated in /root/t/fin.php on line 4
Deprecated: Function is_double() is deprecated since 8.6, use is_float() instead in /root/t/dep.php on line 4
Deprecated: Function is_integer() is deprecated since 8.6, use is_int() instead in /root/t/dep.php on line 4
Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /root/t/dep.php on line 5
Deprecated: Function metaphone() is deprecated since 8.6, use a userland phonetic matching library instead in /root/t/dep.php on line 6
Deprecated: Function mb_ereg() is deprecated since 8.6, because the underlying library is no longer maintained in /root/t/dep2.php on line 2
Deprecated: http_build_query(): Passing an object for argument #1 $data to http_build_query() is deprecated, call get_object_vars() first instead in /root/t/dep2.php on line 4

The full list is in UPGRADING section 4 and the deprecations RFC. The largest item is the mbstring regex family (mb_ereg(), mb_split() and relatives): UPGRADING says "Mbregex has been deprecated, because the underlying Oniguruma library is no longer maintained" (RFC). Also deprecated: doubleval(), strcoll(), a third argument to define(), the CSV methods of SplFileObject and mysqli_stmt_init().

Is PHP 8.6 faster? What we measured

php.net does not publish a headline speed figure for 8.6. UPGRADING section 14 lists targeted work: printf() with only %s and %d is compiled into string interpolation, array_map() with a first-class callable is compiled into a loop, and JSON encoding of arrays and objects was improved. We timed those on the same container, CLI with opcache.enable_cli=1 and no JIT, median of 5 runs (3 for printf):

Micro-testPHP 8.4.28PHP 8.6.0Change
2,000 x array_map(intval(...), $a) over 1,000 items56 ms31 msabout 45% less time
2 million printf("%s-%d") into an output buffer248 ms198 msabout 20% less time
2 million sprintf("%s-%d")126 ms127 msno difference
2,000 x json_encode() of 1,000 small rows377 ms384 msno gain we could measure

Read this for what it is: tight loops on one machine, with 8.4 built by Debian and 8.6 built by sury. A real page spends most of its time in the database and in I/O, so measure your own application before you quote a number.

How to install PHP 8.6 on Debian 13 and Ubuntu, next to the distro PHP

Debian 13 has PHP 8.4, Ubuntu 24.04 has 8.3 and Ubuntu 26.04 has 8.5. PHP 8.6 is in none of their own archives. The usual source is packages.sury.org, run by Debian Developer Ondrej Sury (deb.sury.org). Compiling from source is out of scope here.

The safe pattern on a server that already runs sites is to add the repository with a pin, so that only php8.6* comes from sury and Debian keeps patching your 8.4. The repository commands come from its own README.txt. As root on Debian 13:

apt-get install -y lsb-release ca-certificates curl
curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
dpkg -i /tmp/debsuryorg-archive-keyring.deb
sh -c 'echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
cat > /etc/apt/preferences.d/sury-php <<'EOF'
# Keep Debian's own PHP 8.4 and libraries; take only PHP 8.6 from sury.org
Package: *
Pin: origin packages.sury.org
Pin-Priority: 100

Package: php8.6*
Pin: origin packages.sury.org
Pin-Priority: 500
EOF
apt-get update
apt-cache policy php8.6-fpm php8.4-fpm
apt-get install -y php8.6-fpm php8.6-cli

The policy output proves the pin works: 8.6 comes from sury, and the 8.4 candidate stays Debian's security build even though sury offers a higher version string.

php8.6-fpm:
  Installed: (none)
  Candidate: 8.6.0-3+debsuryorg13.1+1
...
php8.4-fpm:
  Installed: 8.4.28-1~deb13u1
  Candidate: 8.4.28-1~deb13u1
  Version table:
     8.4.28-3+debsuryorg13.1+1 100
...

After the install, both services were active and each had its own socket, /run/php/php8.4-fpm.sock and /run/php/php8.6-fpm.sock, with separate settings under /etc/php/8.4/ and /etc/php/8.6/. To move one site, point its nginx fastcgi_pass line at the 8.6 socket and reload nginx. To move it back, change the line back.

One trap we hit: the install printed update-alternatives: using /usr/bin/php8.6 to provide /usr/bin/php (php) in auto mode. From that moment the plain php command, and with it every cron job and Composer run that calls php, used 8.6. The websites stayed on 8.4. Call php8.4 or php8.6 by full name in scripts, or fix the command with update-alternatives --set php /usr/bin/php8.4, which we show with its output in how to install PHP on Debian 13.

Extensions follow the same naming: php8.6-mbstring, -xml, -curl, -zip, -intl, -gd, -mysql and -sqlite3 all installed in our lab, and the repository listed redis, imagick, apcu and memcached too. Its php8.6-xdebug candidate was 3.6.0~alpha1, so the debugger packaged for 8.6 was still an alpha.

On Ubuntu the steps are the same with the Ubuntu codename: packages.sury.org carried 8.6.0-3+debsuryorg24.04.1+1 for 24.04 and 8.6.0-3+debsuryorg26.04.1+1 for 26.04. The old ppa:ondrej/php is frozen, as its Launchpad page says. We did not run the Ubuntu install for this article; the walk-through is in install PHP on Ubuntu 26.04 and 24.04. Unattended-upgrades skips the sury origin by default, so 8.6 will not patch itself unless you allow it.

PHP 8.6 in Docker: tags and one surprise

The official image had 8.6.0 tags on release day (Docker Hub php tags): 8.6, 8.6-cli, 8.6-fpm and 8.6-apache on Debian trixie or bookworm, plus 8.6-alpine and 8.6-fpm-alpine.

docker run --rm php:8.6-cli php -v | head -1
docker run --rm php:8.6-fpm-alpine php-fpm -v | head -1
docker run --rm php:8.5-cli php -v | head -1
docker run --rm php:latest php -r 'echo PHP_VERSION, "\n";'
PHP 8.6.0 (cli) (built: Nov 19 2026 15:17:27) (ZTS)
PHP 8.6.0 (fpm-fcgi) (built: Nov 19 2026 15:18:18) (ZTS)
PHP 8.5.13 (cli) (built: Nov 19 2026 14:29:14) (NTS)
8.6.0

Two things to take from that. First, php:latest is already 8.6.0, so a Dockerfile that says FROM php:latest moves to 8.6 on its next rebuild; pin the minor version. Second, the 8.6 images we pulled report ZTS, and php -i confirmed Thread Safety => enabled, while the 8.5 image is NTS. A compiled extension has to match the build it is loaded into, so if you copy prebuilt extension files into your image, rebuild them inside the 8.6 image instead.

Laravel, WordPress and Composer on PHP 8.6

We only repeat what each project says itself, plus what we ran.

Should I upgrade to PHP 8.6? A decision table

Your situationWhat to do nowWhy
Production site on Debian 13Stay on Debian's PHP 8.4; test on 8.6 side by side8.4 is patched through Debian's security archive and has php.net security fixes until 31 Dec 2028; nothing forces a move
New project, no legacy codeStart on 8.6Longest support (to 31 Dec 2030) and you never write code that 8.6 deprecates
WordPress siteWaitWordPress had not listed 8.6 in its own table; plugins need time
Laravel applicationRun CI on 8.6 now, switch production when Laravel lists itThe skeleton worked for us, but Laravel's table stopped at 8.5
Docker applicationTry php:8.6-fpm in a branch; pin the tag either wayRollback is one line; mind the ZTS build and rebuild extensions
Still on PHP 8.2 or olderMove this year, to 8.4 or 8.5 first8.2 has no fixes after 31 Dec 2026; a smaller jump is easier to test

One more reason not to rush a busy site: the NEWS file of the PHP-8.6 branch already lists fixes queued for 8.6.1, several of them for partial function application. That is normal for a .0 release. If you stay on an older branch, keep it patched: our PHP security update guide for November 2026 has the fixed versions for 8.2 to 8.5.

What we did not test

We did not run a real WordPress site or any plugin on 8.6; a syntax check is not a functional test. We did not test the JIT, Apache with mod_php, Windows or ARM, and on Ubuntu we only read the package index. The benchmarks are micro-tests. We found no statement from Symfony about 8.6 support to link, so Symfony is left out.

Frequently asked questions

When was PHP 8.6 released?

PHP 8.6.0 was released on 19 November 2026, according to the php.net release announcement. It is in active support until 31 December 2028 and gets security fixes until 31 December 2030.

What are the main new features in PHP 8.6?

Partial function application with ? placeholders, the Time\Duration class, the Io\Poll API, clamp(), the SortDirection enum, default values for readonly properties and stream errors as exceptions.

Will PHP 8.6 break my site?

Most code runs unchanged. The changes most likely to be felt are the new session defaults (strict mode on, HttpOnly on, SameSite Lax), trim() also removing form feed, and new deprecation notices for functions such as is_double(), spl_object_hash() and mb_ereg(). Test on a copy of the site first.

Can I install PHP 8.6 on Debian 13?

Yes, from packages.sury.org, which offered php8.6-fpm 8.6.0-3+debsuryorg13.1+1 for Debian 13 on 22 November 2026. With an apt pin, it runs next to Debian's own PHP 8.4, which Debian keeps patching.

Is there a PHP 8.6 Docker image?

Yes. The official image has php:8.6, php:8.6-cli, php:8.6-fpm, php:8.6-apache and Alpine variants, and php:latest is 8.6.0. The 8.6 images we pulled were ZTS builds, so rebuild your extensions inside the new image.

Does Laravel or WordPress support PHP 8.6?

On 22 November 2026 neither project listed PHP 8.6 in its compatibility table: Laravel 13 was listed for PHP 8.3 to 8.5 and WordPress's table ended at 8.5. A fresh Laravel 13.43.0 skeleton passed its example tests on 8.6.0 in our lab.

Is PHP 8.6 faster than PHP 8.4?

In specific cases. In our micro-tests array_map() with a first-class callable took about 45% less time and printf() about 20% less, while sprintf() and json_encode() showed no measurable change. php.net gives no overall figure.

Sources

All checked on 22 November 2026.

Need a hand?

The quickest way to find out what 8.6 does to your code is a spare server with both versions on it. A Debian 13 VPS or VDS with NVMe in Amsterdam, Dublin or Prishtina is deployed in under 60 seconds after payment, has full root and free weekly backups, and takes the side-by-side setup above as written. For a production PHP application, where PHP-FPM workers need the same CPU time at peak as at night, pick a VDS with dedicated vCPUs. We also do custom offers, custom setups and systems built for you, such as moving an application from an old PHP branch to 8.4 or 8.6, quoted per job: write to us on Telegram or at info@rscomputers-ks.com.

← All articles

Chat on Telegram