
PHP 8.4 was released November 21, 2024. As of this writing, you can use PHP 8.4 on cPanel VPS environments and Dedicated servers by enabling the package in EasyApache. PHP 8.4 will be added to shared servers after a brief period of testing by InMotion’s Engineering team.
As of January 17, 2025, PHP 8.4 is now available on all shared hosting plans. At this time, IonCube Loader is not yet available for 8.4.
What’s new in PHP 8.4?
HTML 5 Compatibility
One of the largest improvements is to the \DOMDocument library, which in previous versions was almost compatible with HTML 4. While HTML 5 has been around for over 16 years, PHP still relied on a shoehorn method of using LIBXML and quiet errors to parse most tags outside of the most basic HTML tags.
In PHP 8.4, the new \Dom\HTMLDocument object allows parsing of all HTML5-compliant tags, and because it’s using the new \Dom\ namespace, remains fully backward-compatible with the old \DOMDocument objects. This means developers can continue to use older code that works, but take advantage of the new features as they develop new products.
Property Hooks
Property Hooks will be a boon to developers, allowing them to skip a lot of the basic “boilerplate” code that was previously needed when creating new classes and objects.
Take for example the following class from the PHP Foundation announcement, which contains a few private members:
In this example, the developer has had to write explicit getter and setter functions for each of the member variables. In PHP 8.4, however, it is much easier:
Invoke New Class Methods without Parentheses
In previous versions of PHP, if you wanted to invoke a method of a new class on the same line, the class declaration had to be wrapped in parentheses, like so:
Now, this is more convenient with the new syntax:
Implement Your Own Deprecations With the #[\Deprecated] Attribute
You can now use PHP’s built-in deprecation mechanism to alert developers using your code of new ways to accomplish deprecated methods. This will create automatic debug output, similar to deprecations in PHP core.
New Array Functions and More
New functions, including array_find(), array_find_key(), array_any(), and array_all() have been introduced to avoid having to write your own searching functions. There are many other new features, be sure to check out the PHP Official Release announcement here.
PHP 8.4 Availability on your InMotion Hosting Server
PHP 8.4 is already available on VPS and Shared accounts using cPanel. VPS users with root access can use EasyApache for cPanel to install the new version.
Control Web Panel (CWP) does not yet support PHP 8.4.