PHP is the engine of WordPress. A new version of PHP means improvements to this engine and fixes detected malfunctions.
Like car engines - their newer models are more economical, but more productive, more environmentally friendly, but more reliable, and even more, more, more. But instead of changing the oil, when repairing the PHP engine, we have to replace the outdated and blockеа PHP code.
Each new version of PHP is faster, with improved security and new features. Therefore, sites that use the new PHP versions are faster and more secure than those that use the old PHP versions.
Why use a new version of PHP for WordPress?
Security, speed, and compatibility.
Using older versions of PHP poses a security risk to the site. These versions reveal vulnerabilities that can be exploited by malicious individuals to break into sites. The only protection against this is to regularly activate the latest version of PHP and update the versions of WordPress, the theme, and plugins.
Speed is another big reason to activate a new PHP version for the site. Each subsequent PHP version comes with many improvements in features and performance. We saw a particularly noticeable acceleration in the loading of sites when switching from PHP 5.6 to PHP 7.x. But the latest version of PHP 8 also has big performance improvements.
Another reason is compatibility with newer versions of WordPress, themes, and plugins. If you do not use a new version of PHP, you will not be able to update WordPress and its plugins to the latest versions.
The benefits of using a new PHP version for your site:
- Improved overall security of the code, including the site;
- Improved site performance, which makes it faster to load;
- You will be able to update WordPress, the theme and plugins to the latest versions;
- You will be able to install new and modern plugins that do not work with older versions of PHP.
What does new version of PHP mean?
The WordPress platform is written in the PHP programming language. Its files contain PHP code that is executed on the server each time a page is loaded from the site in the browser. The execution of the PHP code generates the HTML code of each page on the site.
A server program that understands the PHP language (grammar and words) - that is, reads and executes PHP code in files - is called a PHP interpreter (or PHP Zend Engine). It depends on this interpreter how fast and how the PHP code will be executed.
A new version of PHP means two things:
New version of the PHP interpreter. There are performance improvements and bug fixes in the PHP engine. Sometimes this can mean that some old features that don't work well have been removed and new ones added.
New version of PHP language. There are improvements in the PHP programming language itself - for example, changes in its syntax or new features, operators, etc. may be added.
Therefore, when we try to submit old PHP code (for example written according to the rules of PHP 5.6) to a PHP engine (for example PHP 8), there is a high probability that it will not work, will not be executed. Most often, an error message is received and the page or the entire site does not load. An example of such a case is when we activate the PHP 8 engine for an old version of WordPress (or a plugin, theme) that has old PHP code (PHP 5.6).
If we have updated PHP code that uses the new features of PHP 8, but runs it on an old version of the PHP engine (for example 5.6), then the new features will certainly not work.
PHP 8.x - the new version of PHP
Currently, the latest version of PHP that you can enable in cPanel is PHP 8.0. This version has many improvements in the language and performance of the PHP engine.
Older PHP versions do not receive security enhancements or fixes. Active support for PHP 7.4 ended in November 2021, and security support will end in November 2022. It is a good idea to enable the new version of PHP 8 for WordPress as soon as possible.
Activate a new PHP version for WordPress
Enabling a new PHP version for WordPress is easy through PHP Manager in cPanel. But before that, you need to make sure that WordPress, the theme, and plugins are compatible with the new version of PHP.
If everything on the site is updated to the latest versions, for example WordPress is updated to 5.9 and the theme and plugins are updated, switching to PHP 8 should not create any issues with your site.
Just in case, make a backup of the site or check when is the last system backup in cPanel. If the backup date suits you, activate the new PHP version. If you notice that some functionality on the site does not work properly, you can revert to the previous version of PHP - again through PHP Manager in cPanel.
Note: Through PHP Manager by SH, a new PHP version can be activated for the entire hosting account or only for a single site in it.
Activating a new PHP version is more complicated when the components on the site are not updated and use old PHP code. In this case, you first need to update WordPress, the theme and plugins and then activate the new PHP version.
To seamlessly enable a new PHP version for your site, follow these steps:
- Create a test copy of the site;
- Update everything in the copy - WordPress, theme, plugins;
- Activate a new PHP version for the copy via PHP Manager by SuperHosting (for a specific directory);
- Test in detail the work of the site, the theme and plugins;
- Make a backup of the real site;
- Apply the changes to the real site after everything has been tested and works properly.
Nadejda Milanova
An experienced Content creator in the field of Search Engine Optimization (SEO) and WordPress. A true proffesional with a Master's degree focused on journalism.
Read more by Nadejda Milanova