PHP 8.6 is available on all servers
PHP 8.6.0 was released today, November 19, 2026, and is available on servers managed by ServerPilot. There are many improvements, changes, new features, and deprecations in PHP 8.6.
Here we’ll provide a summary of the most important changes in PHP 8.6. For the full list of changes, see PHP’s official documentation on migrating code from PHP 8.5 to 8.6.
PHP 8.6 is available on servers running Ubuntu 20.04 and newer.
Changes in PHP 8.6
New Features in PHP 8.6
Partial function application
PHP 8.6 adds partial function application. When you call a function with some of its arguments
and use the ? or … placeholder for the rest, PHP doesn’t call the function.
Instead, it returns a closure, and the function runs when you call the closure with the remaining arguments. Learn
more.
clamp function
PHP 8.6 adds a new function named clamp that limits a value to a minimum and maximum.
If the value is below the minimum, clamp returns the minimum. If the value is above
the maximum, clamp returns the maximum. Learn
more.
Time\Duration class
The Date extension in PHP 8.6 adds a new class named Time\Duration.
It represents a fixed length of elapsed time, such as a timeout or the time measured by a stopwatch,
with nanosecond precision. Learn
more.
Polling API
PHP 8.6 adds a new polling API in the Io\Poll namespace. It watches many streams
at once using the operating system’s native mechanisms, such as epoll, without the
scalability limits of stream_select. Event loop libraries such as ReactPHP and AMPHP can build on it. Learn
more.
SortDirection enum
PHP 8.6 adds a new enum named SortDirection with the cases Ascending
and Descending. Libraries can use it in their own APIs. PHP’s built-in sorting
functions don’t accept it yet. Learn
more.
Default values for readonly properties
Instance readonly properties, including those of readonly classes, may now have default values. The default value is set before the constructor runs, so the constructor can’t assign the property again. Learn more.
#[\Override] attribute for class constants
The #[\Override] attribute can now be used on class constants, including enum cases, to check
that the constant exists in a parent class or implemented interface. Learn
more.
grapheme_strrev function
The Intl extension in PHP 8.6 adds a new function named grapheme_strrev
that reverses a string by grapheme cluster. Unlike strrev, it keeps characters such as emoji intact. Learn
more.
Error locations in JSON error messages
Error messages from json_last_error_msg and JsonException
now include information about where in the JSON the error occurred. Learn
more.
mysqli_quote_string function and mysqli::quote_string method
The MySQLi extension in PHP 8.6 adds a new function named mysqli_quote_string
and a new method named mysqli::quote_string. They escape a string the same way as
mysqli::real_escape_string and wrap the result in single quotes, like PDO::quote. Learn
more.
error_include_args INI directive to show function arguments in errors
When the new error_include_args INI directive is enabled, error messages
include the arguments that were passed to the function. It is off by default. If you enable it,
argument values can appear in your error logs, although PHP hides parameters marked as sensitive. Learn
more.
Backward-Incompatible Changes in PHP 8.6
Changes in PHP 8.6 that are not backward-compatible can change the behavior of code written for earlier PHP versions, or break it.
More secure session defaults
PHP 8.6 changes the default values of three session INI directives to make sessions more secure:
session.use_strict_modeis now1(previously0), so PHP ignores a session ID that doesn’t belong to an existing session and issues a new one instead. Custom session handlers need thevalidateIdandcreate_sidmethods for strict mode.session.cookie_httponlyis now1(previously0), so JavaScript can no longer read the session cookie.session.cookie_samesiteis nowLax(previously not set), so browsers don’t send the session cookie with requests to your app that come from other websites, such as form posts (used by some payment gateway and single sign-on callbacks). The exception is a top-level navigation with a safe method such as GET, like following a link from another website that opens your app.
If your app depends on the previous defaults, you can change these
settings for your app with a .user.ini file.
For example, if your app needs the session cookie on requests from other websites
and uses HTTPS, add these lines to its .user.ini file:
session.cookie_samesite = "None"session.cookie_secure = 1Only do this if your app needs it, because it removes the cross-site protection that Lax provides.
trim functions now remove form feed characters
The trim, ltrim, and rtrim functions now also remove the form feed
character (\f) by default. Learn
more.
Deprecations in PHP 8.6
- Returning a value from
__constructor__destructis deprecated. - Using
returnin afinallyblock is deprecated. - The
is_double,is_long,is_integer, anddoublevalfunctions are deprecated. Useis_float,is_int, andfloatvalinstead. - The
spl_object_hashfunction is deprecated. Usespl_object_idinstead. - Custom session handlers that don’t implement both the
create_sidandvalidateIdmethods are deprecated. - The regular expression functions in the
mbstringextension (mbregex), such asmb_eregandmb_split, are deprecated because the Oniguruma library they use is no longer maintained. They will be removed in PHP 9.0. For most UTF-8 use cases, use thepreg_*functions with theumodifier instead. - The
metaphonefunction is deprecated. - The
strcollfunction and theSORT_LOCALE_STRINGflag are deprecated. Use theCollatorclass from theIntlextension instead.
How to Switch to PHP 8.6
To change an app to use PHP 8.6, go to Apps, click on the app’s name, click Edit app, select PHP 8.6 from the PHP Version drop-down, and click Update. If your app does not work with PHP 8.6, you can easily change back to the PHP version you were using before.
If PHP 8.6 isn’t listed, go to Servers, click on the server’s name, and next to PHP Versions, click Configure to install or enable PHP 8.6.
As always, please contact us if you have any questions.