We have been working hard for some time now to ensure PHP 8.1 runs smoothly on our servers. With an official release on November 25, 2021, PHP 8.1 is finally available on the Cloudways platform!
PHP 8.1 brings new features, performance improvements, better syntax, and more.
What’s new in PHP 8.1
Bug-Free Scalar Type Hints
PHP now gets way better error messages when type hinting doesn’t coordinate. This implies that if you’re expecting a string and PHP gets an integer, PHP will throw a clear and brief error message to assist you in debugging the issue. This can be just one of the ways PHP 8.1 helps you keep your PHP applications secure and bug-free.
Type Declarations
PHP 8.1 now underpins return type declarations, which means that PHP will be able to tell what kind of information you’re expecting back from work. PHP 8.1 helps with not only security but also PHP execution as PHP will be able to execute the function and return the sort of data you’ve requested for without an extra step which speeds up PHP execution!
Enums
PHP 8.1 includes support for Identifications. An Enum is an enumerated type with several possible values. A well-known analogy for an Enum is suited in a deck of playing cards. A deck of playing cards has four suits, and they are settled: Clubs, Diamonds, Hearts, and Spades.
PHP 7 Compatibility
PHP 8.1 presently has improved compatibility with PHP 7, so PHP developers don’t need to rewrite their PHP scripts for PHP 7. PHP 8.1 is reverse compatible with PHP 7, so you don’t have to rewrite your code.
See all updates in detail on the PHP team website.
How to Switch to PHP 8.1
We suggest you first start testing your applications on the 8.1 version before upgrading.
If you use code that is outdated and potentially not supported in the newer version of PHP, then you should be expecting to see errors or even your site not working altogether.
Before updating your PHP version, ensure you first update your CMS to the latest version, or if you use custom code, it is compatible.
Upgrading to PHP 8.1 on Cloudways
First test your applications on 8.1. You can clone your server, update your PHP version, and test for issues on your applications. When you are ready, push changes to your live server.
So now, you can move to PHP hosting platform, launch a managed server and a custom PHP application within a few clicks, and have the confidence that you have a strong establishment for your PHP-powered business websites and applications.
To immediately upgrade your server to PHP 8.1 you can follow the steps below:
Go to Server Management > Access Detail > Settings & Packages tab
Select PHP 8.1 from the drop-down menu
Click Save
Read the warning and click OK
The upgrade process takes a few minutes, and your server will be upgraded without any downtime.
Next, to verify that PHP 8.1 is indeed available at your server, Launch the SSH terminal from the Master Credentials tab and log in using your credentials. Use the PHP -v
command to check the installed PHP version.
As you can see, the server has been upgraded to PHP 8.1.
PHP Versions Status on Cloudways Platform
At the moment, you have the options of PHP 7.4, 8.0, and 8.1, with PHP 7.4 being the default version. Several older PHP versions have been recently deprecated on our platform, meaning you won’t be able to select those when creating a new server. Nothing to worry about, existing servers and applications on deprecated versions remain functional. See more details on dates in the table below.
PHP versions | Deprecation Date* | End Of Life (EOL)** |
---|---|---|
5.6, 7.0, 7.1, 7.2, 7.3 | 15 Aug 2022 | 31 Aug 2023 |
Deprecation Date*: The date a PHP version becomes unavailable for new servers on the Cloudways platform. For servers already using a deprecated PHP version, it will remain functional and supported until its End Of Life date. Learn more about our deprecation policy here.
End Of Life (EOL)**: The PHP version is retired and removed entirely from the Cloudways platform. The remaining applications on the retired PHP will be automatically migrated to the latest stable version.
Why should I update to the latest supported PHP?
Security is the most obvious benefit of updating to a stable, supported PHP version. PHP versions do not receive security updates after their EOL date, creating high-risk vulnerabilities for attackers to exploit. In the case of WordPress, you will also see a noticeable improvement in speed with newer versions (7.4 and on), bringing faster execution times and less memory usage.
What happens if I don’t upgrade before the EOL date?
If the PHP version reaches End Of Life before you have the chance to update your applications, then we will automatically update them to the latest stable version. There is a minimum of 6 months before a deprecated version reaches its EOL, so you have plenty of time to test your application. To avoid unexpected errors with your websites and applications, we advise you to test and upgrade them well before the EOL date.
If you require any help during this process, do not hesitate to contact our technical support via Live Chat or Support Ticket.
Shahzeb Ahmed
Shahzeb is a Digital Marketer with a Software Engineering background, works as a Community Manager — PHP Community at Cloudways. He is growth ambitious and aims to learn & share information about PHP & Laravel Development through practice and experimentation. He loves to travel and explore new ideas whenever he finds time. Get in touch with him at [email protected]