Skip to main content
Fewer throwaway closures, durations you can add and compare instead of counting microseconds, and session cookies that are locked down by default. PHP 8.6 is a release of small, practical changes that show up in everyday code. PHP 8.6 was officially released on November 19, 2026, and you can use it on your Upsun Cloud projects today.

How to upgrade

Install it locally

Follow the official instructions for your system: Then check the version:

Create a test environment

Update your dependencies

Switch the runtime version

Update the type of your app in .upsun/config.yaml:
Push with upsun push and test the environment. When everything works, merge with upsun merge. See the supported PHP versions and the available extensions in the Upsun Cloud docs.
Before you upgrade production: PHP 8.6 has backward incompatible changes, including new session defaults. Review them, and the checklist at the end of this post, on your test environment first.

What’s new in PHP 8.6

The PHP team publishes everything you need to plan the upgrade: Here are the changes you are most likely to use first. The examples come from the PHP 8.6 release page and the migration guide.

Partial function application

Fix some of a function’s arguments in advance and get a closure that takes the rest. ? stands for one argument, ... for all the remaining ones. It works with any callable, including internal functions. Previously, filtering a list with a built-in function meant writing an arrow function:
With PHP 8.6:
And with your own functions:

Time\Duration

Timeouts, delays and retry backoffs no longer have to be integers in an implicit unit. Time\Duration is an immutable value with nanosecond precision, independent of time zones. You can add, subtract, multiply and compare durations directly.

clamp()

Keep a value within bounds without nesting min() and max():
It works with any comparable value, Duration included.

SortDirection

A shared enum with Ascending and Descending cases, so libraries can type sort order instead of accepting any integer:
Passing SORT_STRING by mistake now fails with a TypeError at the call, instead of an UnhandledMatchError deep inside the method.

Readonly property defaults

Readonly properties and readonly classes can declare a default value, so you no longer need a constructor just to set a constant:

And more

  • Polling API (Io\Poll): scalable stream I/O multiplexing on epoll, kqueue, event ports or WSAPoll, past the limits of stream_select(). A new foundation for async libraries such as ReactPHP and AMPHP.
  • Structured stream errors: opt in to StreamException with StreamError objects and a StreamErrorCode enum, instead of parsing error_get_last() messages.
  • URI builders: Uri\Rfc3986\UriBuilder and Uri\WhatWg\UrlBuilder complete the URI extension added in PHP 8.5.
  • Reflection: ReflectionParameter::getDocComment(), ReflectionProperty::isReadable() and isWritable().
  • Security: TLS session resumption, and post-quantum key encapsulation in Sodium (X-Wing, ML-KEM-768).

What to check before upgrading

Breaking changes

The full list covers many extensions. These are the ones most likely to affect a web app:
  • Session defaults: session.use_strict_mode is now 1, session.cookie_httponly is now 1 and session.cookie_samesite is now "Lax". Safer by default, but test cross-site flows such as embedded apps or single sign-on.
  • trim(), ltrim() and rtrim() now strip form feed (\f) by default.
  • ValueError on bad input: many functions, such as getenv(), putenv(), filesize() and sleep(), now throw for NUL bytes or out-of-range values.
  • preg_grep() returns false on a PCRE execution error, instead of a partial array.
  • unpack() reads < and > after a format code as an endianness modifier, which changes the keys of some existing format strings.

Deprecations

Run your test suite with deprecations visible. The full list is long. These are the most common in application code:
  • return inside a finally block
  • Returning a value from __construct() or __destruct()
  • The mbstring regex functions (mb_ereg*, mb_split() and related), planned for removal in PHP 9.0
  • is_double(), is_long(), is_integer() and doubleval()
  • spl_object_hash(), in favor of spl_object_id()
  • define() with a third argument

What’s next

PHP 8.6, 8.5, and 8.4 are the supported PHP versions on Upsun Cloud. Create a branch, switch the type, and see how your app runs on 8.6. Found an extension or a framework that needs attention? Tell us on the community forum.
Last modified on November 27, 2026