PHP 8.5 was released on 20 November 2025 and is currently the latest stable branch of PHP. It introduced a number of language innovations that developers had been waiting for for years (the pipe operator, clone with, built-in URI handling) and deprecated a few older solutions that still appear in older extensions and templates. The good news is that you don’t need to be a programmer to take advantage of it. On our NVMe SSD web hosting, you can choose between PHP 8.3, 8.4 and 8.5, while on cPanel hosting, you can switch to any version from PHP 5.1 to 8.5 using the CloudLinux PHP Selector – with just one click and with the option to revert at any time.
In this article, we’ll briefly go through what’s new in PHP 8.5, how long support will continue for each PHP branch, and how to check your website’s compatibility before making the switch. At the end, we’ll also show you what to do if something isn’t working after the switch.
How long are PHP versions supported for?
Every branch of PHP receives active support (bug fixes and security patches) for two years, followed by a further two years of security patches only. Once a branch reaches the end of this period, the PHP developers will no longer fix it, even if they discover a serious vulnerability. Official data from php.net:
| PHP branch | Publication | End of active support | Security patches complete |
|---|---|---|---|
| 8.1 | 25 November 2021 | 25 November 2023 | 31 December 2025 (expired) |
| 8.2 | 8 December 2022 | 31 December 2024 | 31 December 2026 |
| 8.3 | 23 November 2023 | 31 December 2025 | 31 December 2027 |
| 8.4 | 21 November 2024 | 31 December 2026 | 31 December 2028 |
| 8.5 | 20 November 2025 | 31 December 2027 | 31 December 2029 |
PHP 8.2 will therefore reach end-of-life at the end of the year; you can read about the details and what to do in our article on the end of support for PHP 8.2. The PHP2Shell vulnerability in October demonstrated what this means in practice: php.net only released a patched version for the supported branches.
The key new features of PHP 8.5
Pipe operator (|>)
The pipe operator passes a value from left to right through a series of functions: each step receives the result of the previous one. This means there is no need to read nested function calls from the inside out, nor to create temporary variables.
$title = ' PHP 8.5 Released ';
$slug = $title
|> trim(...)
|> (fn($str) => str_replace(' ', '-', $str))
|> (fn($str) => str_replace('.', '', $str))
|> strtolower(...);
// "php-85-released"
The right-hand side can contain any callable expression with a single parameter. The arrow functions must be enclosed in brackets, as shown in the example.
Clone with
clone() can now also take an array of properties to be modified. This is particularly useful for readonly classes, where it was previously cumbersome to create a copy of an object with one or two different values (the so-called ‘with-er’ pattern):
public function withAlpha(int $alpha): self
{
return clone($this, [
'alpha' => $alpha,
]);
}
Built-in URI extension
The new, always-available URI extension processes web addresses in a standardised manner, in accordance with both RFC 3986 and the WHATWG URL standard used by browsers. Until now, this task was handled by parse_url(), which, in some extreme cases, interpreted the address differently from the browser, and this could have led to security vulnerabilities.
use Uri\Rfc3986\Uri;
$uri = new Uri('https://php.net/releases/8.5/en.php');
echo $uri->getHost(); // "php.net"
#[\NoDiscard] attribute
If you mark a function with this attribute, PHP will issue a warning whenever someone fails to use its return value. This is useful for functions where omitting the return value is almost certainly an error (for example, if the result indicates whether the operation was successful). If you are intentionally discarding the value, you can indicate this using the (void) type cast.
array_first() and array_last()
Two long-missing functions: they return the first and last elements of an array, or null if the array is empty. Until now, workarounds such as reset(), end() or array_key_first() had to be used for this.
$lastEvent = array_last($events);
Closures in constant expressions
Static closures and first-class callables (such as strlen(...)) can now also appear in constant expressions: in attribute parameters, in the default values of properties and parameters, and in constants. This allows frameworks, for example, to specify authorisation checks directly within an attribute.
Backtrace for fatal errors
Messages for fatal errors (such as ‘Maximum execution time exceeded’) now include a backtrace, so the error log reveals which section of code led to the error. This is controlled by the new fatal_error_backtraces INI setting. In the case of a ‘Maximum execution time exceeded’ error caused by a slow WordPress plugin, this saves you a lot of guesswork.
More news in brief
Closure::getCurrent()– simpler recursion in anonymous functions.- Attributes can also be applied to constants, to
#[\Override]properties, to#[\Deprecated]traits and to constants. - Asymmetric visibility for static properties, and the
finalmodifier for properties promoted in the constructor. - Persistent cURL share handles (
curl_share_init_persistent()): DNS lookups and connections can be reused across multiple requests. - The
setcookie()andsetrawcookie()functions supportpartitionedd keys. - New
get_error_handler()andget_exception_handler()functions. - A new
max_memory_limitINI setting, which sets an upper limit on how high thememory_limitcan be increased while the program is running. - The command
php --ini=difflists which settings differ from the default. - OPcache is now always part of PHP; it is no longer a separate extension that needs to be loaded (the
opcache.enablesetting remains valid).
What has been deprecated in PHP 8.5?
Deprecated functions are still working for the time being, but when used, PHP logs an E_DEPRECATED warning, and they may be removed in a future major release. These are most commonly found in older plugins and templates:
- The backtick operator: the
`ls -la`syntax is deprecated as a shorthand forshell_exec();shell_exec('ls -la')should be used instead. - Non-canonical type constraints: use
(bool),(int),(float)and(string)instead of(boolean),(integer),(double)and(binary). nullas an array index: passing$a[null]andnulltoarray_key_exists()is deprecated; an empty string should be used instead.cases ending with a semicolon: the branches of aswitchmust end with a colon.__sleep()and__wakeup(): ‘soft’ deprecation, without warning;__serialize()and__unserialize()are recommended in the new code.- Unnecessary ‘close’ functions:
curl_close(),imagedestroy(),finfo_close()andxml_parser_free()are deprecated, as resources are now objects and are automatically released.
Some changes also trigger warnings: for example, if a floating-point number does not fit as an integer but is nevertheless cast to type int, or if a non-array value is unpacked using the [] or list() construct. The disable_classes INI setting has been deprecated. The full list is available in the migration guide on php.net.
What does all this mean for your website?
If you’re running WordPress, Joomla, PrestaShop or an application built on a framework, you don’t need to use the new language features yourself: the developers are gradually incorporating them. The question is whether the code you’re using today (the core, plugins and templates) will run without errors on PHP 8.5.
The WordPress core has supported PHP 8.5 since version 6.9 (at that time it was still labelled as ‘beta’, a designation that has since been dropped). When it comes to plugins and themes, however, the picture is mixed: well-maintained ones usually keep up with new versions quickly, while plugins that haven’t been updated for a long time, or are custom-built or abandoned, can cause problems. We’ve written a separate article in more detail about which PHP version is best for WordPress.
Before updating: how to check compatibility
- Make a backup. Of both your files and your database. The Web Starter plan includes automatic backups on the web hosting service, but it’s always a good idea to make your own copy before switching: export the database via phpMyAdmin and download the files via FTP. On cPanel hosting, you can create a backup of your entire account (see steps here); for WordPress, a backup plugin will do the job.
- Update everything to the current version of PHP. First update the WordPress core, plugins and theme, and only then update PHP. If you change everything at once, it’s difficult to work out what caused the error.
- Take a look at the plugin’s details page. On WordPress.org, the minimum PHP version and the date of the last update are shown for every plugin. If a plugin hasn’t been updated for a year or two, it’s worth looking for an alternative.
-
Run a static analysis if you have custom code. The PHPCompatibility rule set uses PHP_CodeSniffer to detect deprecated or obsolete functions in your code. The PHP 8.5 rules are in the 10 development branch (the older 9.3.5 release only recognises changes in PHP 7.x). Run it on your own machine, in the project directory:
composer require --dev phpcompatibility/php-compatibility:"^10.0.0@dev" vendor/bin/phpcs -p wp-content/themes/sajat-sablon --standard=PHPCompatibility --runtime-set testVersion 8.5 - Try it out on a test site. The safest approach is to make the changes on a copy of the site (staging) first. On cPanel hosting, the WP Toolkit can create one with just a few clicks (the WP Toolkit staging steps), while our WordPress staging article goes into more detail about the methods.
-
Enable the error log. In WordPress, you can configure the
wp-config.phpfile to redirect errors and warnings to thewp-content/debug.logfile so that visitors cannot see them:define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false );After testing, set the
WP_DEBUGvalue back tofalseand delete the log file.
After the switch, click through the most important parts of the site: the homepage, a blog post, the contact form, the shopping basket and checkout in the online shop, and the admin panel. Then check the error log: ‘deprecated’ warnings do not yet cause errors, but they indicate which plugins will need to be updated or replaced.
Changing the PHP version on your web hosting account (KeyHelp)
Our web hosting control panel is KeyHelp, which is available in Hungarian (the basics are covered in our getting started guide). Here, you can set the PHP version for each domain:
- Log in to the KeyHelp dashboard and open the ‘Domains’ menu item.
- In the domain field, click on the pencil icon, then select the ‘Help’ tab.
- In the PHP interpreter list, select the desired version (8.3, 8.4 or 8.5). If you want the same settings to apply to subdomains (such as
www-re), tick the ‘Apply PHP interpreter to all subdomains’ option, then save the changes. - Please refresh the page and check that it is working.
As only supported PHP branches run on our web hosting service, the question here isn’t whether a particular version is secure, but which one works best with your website. If you can’t find the setting or are unsure, please get in touch and we’ll help you.
Changing the PHP version on cPanel hosting (CloudLinux PHP Selector)
On cPanel hosting, the CloudLinux PHP Selector (known as ‘Select PHP Version’ in cPanel) sets the PHP version for the entire hosting account. The steps are illustrated with images in the knowledge base article on changing the default PHP version; in brief:
- In the cPanel Software group, open the ‘Select PHP Version’ menu item.
- In the ‘Current PHP version’ list, select 8.5 (or your preferred version) and confirm by clicking the ‘Set as current’ button.
- Check your extensions. In the PHP Selector, extensions (such as
imagick,intlorioncube_loader) can be enabled or disabled on a per-version basis, so when switching to a new version, check that the modules required by your website are enabled. You can find details in the article on managing PHP extensions.
If you have multiple websites running on your hosting account and only one of them requires a different version, you can set a different PHP version for each directory using a single line in the .htaccess file (setting a different PHP version per directory). Older versions are also available for legacy applications on cPanel hosting; our article on HardenedPHP explains how secure these are.
If something isn’t working after the switch
Changing the PHP version takes effect immediately on both types of hosting, and can be reverted just as quickly. If the site displays a blank screen or a ‘500 Internal Server Error’, the first step is always this: revert to the previous version so that visitors can see a working site again. You can then take your time to find out what caused the error.
- Check the error log. The fatal error message will tell you the file name and line number; in PHP 8.5, it now includes the full call stack as well. If the path points to a subdirectory of
wp-content/plugins/, you’ve found the culprit plugin. - “Call to undefined function”: this usually means that an extension (module) is missing from the new version; enable it in the PHP Selector in cPanel.
- A plugin is causing the error: update it, or if there is no newer version available, deactivate it. If the admin panel fails to load, rename the plugin’s directory in the file manager or via FTP, so that WordPress deactivates it.
- ‘Deprecated’ messages on the site: this is not an error; it is simply that error display is enabled. On a live site, disable error display (set
display_errors = Off); logging can remain enabled.
The general steps for troubleshooting are summarised in our article on fixing 500 errors and our guide to the WordPress white screen.
Which version should you choose now?
- PHP 8.5, provided that every part of your website supports it: this version will receive updates for the longest period, until the end of 2029.
- PHP 8.4 is a good, secure default if one or two of your extensions haven’t yet upgraded to 8.5: it will receive active support until the end of 2026 and security patches until the end of 2028.
- PHP 8.3 is only a temporary solution if one of your essential plugins does not work with newer versions: it will receive security updates until the end of 2027.
- PHP 8.2 and earlier: only if there is no other option, and plan the migration as soon as possible.
If you’re still wondering about the purpose of the update – specifically, why updating PHP is important in terms of speed and security – we’ve covered this in more detail in a separate article.
Frequently Asked Questions
Will my website be faster with PHP 8.5?
PHP 8.5 does not deliver as significant a performance boost as PHP 7 or 8.0 did in their day. However, when upgrading from version 7.4 or 8.0, there may be a noticeable improvement in speed and memory usage, and, just as importantly, the supported version will receive security patches.
Do I need to rewrite my website’s code?
For ready-made systems (WordPress, e-commerce platforms), this is generally not necessary: it is sufficient to keep the core, plugins and theme up to date. For bespoke developments, run a PHPCompatibility check and review the error log for deprecation warnings.
How do I know which version of PHP is currently running on my website?
In WordPress, it appears on the Site Health page under the Tools menu, in the Server section of the Information tab. In cPanel, it is at the top of the Select PHP Version page; in KeyHelp, it is in the PHP version column of the Domains list (clicking on the version number opens the full phpinfo page). For a custom page, a file containing a phpinfo() call will also display this information; please delete this file after checking.
Can I revert to a previous version if something isn’t working?
Yes, the version change can be reversed at any time and takes effect immediately. It is therefore advisable to make the change outside of peak periods and to click through the site immediately after the change.
What’s the deal with VPS?
On your own server, you’ll need to install and update PHP yourself, either from the distribution’s packages or from an external repository. If you’d rather not deal with this, we’ll take care of updating PHP versions and applying security patches on the hosting plans listed above.