Why you should use the latest PHP version for your WordPress website

Why you should use the latest PHP version for your WordPress website

What is PHP?

PHP stands for Hypertext Preprocessor, this is an open-source programming language that runs on the web server. According to W3TechsPHP is used by over 79.1% of all the websites that use a server-side programming language. Basically every 8 out of 10 websites you visit are most likely utilizing PHP in some form. Of course PHP plays a very vital role in the WordPress ecosystem, as the entire CMS is built on PHP.

The life cycle of PHP

All of the PHP versions have a life cycle of around three years. After that period of time they are no longer supported.

After the initial release, a PHP version is actively supported for around two years. After that time, there will be 1-2 years of support for patching security vulnerabilities, meaning that there are only releases for critical security issues. Usually during this phase, the next PHP version is already available.

When PHP version reaches end-of-life (EOL), it does not get updates anymore, so after that time it’s no longer secure to use it. You can check the official PHP website to see which versions are currently supported.

What are the benefits of using the latest PHP version for running your website on?

Security

Ensuring that your website runs on the latest PHP version means that it receives full support and security patches. This is a big step towards ensuring that your website remains secure and technologically up to date. PHP 5.4 has not received patches since 2015, PHP 5.5 has not received patches since 2016. PHP 7 and later versions have new security features built into them. These patches include stronger hashing and encrypting for storage of sensitive data and better functionality for identifying content that is potentially dangerous, like malicious code injections, etc. Another big downside of the older PHP versions is that they are allowing poor programming practices. While PHP 7 and above, require a higher standard of coding from its developers. Also PHP version 7.2 and later versions use modern cryptography in their standard library, this step is taken in very few other programming languages so far.

Performance

The release of PHP 7.3 and PHP 7.4 showed huge performance gains! Basically these gains are so big that they do away with the need to make repeated optimizations to keep your website running optimally. PHP 7 itself, allowed systems to execute twice as many requests per second in comparison to PHP 5.6. Christian Vigh also published a PHP performance comparison in which he found that PHP 5.2 was 400% slower than PHP 7. In our tests with WordPress 5.0 and different PHP versions, the results are just shocking:

  • WordPress 5.0 PHP 5.6 benchmark: 89.84 req/sec
  • WordPress 5.0 PHP 7.0 benchmark results: 204.91 req/sec
  • WordPress 5.0 PHP 7.1 benchmark results: 213.08 req/sec
  • WordPress 5.0 PHP 7.2 benchmark results: 231.38 req/sec
  • WordPress 5.0 PHP 7.3 benchmark results: 264.89 req/sec
  • WordPress 5.0 PHP 7.4 benchmark results: 271.54 req/sec

The current version, PHP 7.4, executes almost three times as many requests per second compared to PHP 5.6.

Support and backwards compatibility

This is also another big reason to use the latest and supported PHP version for your WordPress website. Many plugins and themes developers extend support back for older versions so far. A lot of this is due not having enough time and scope to test the compatibility of the new code they write with every system out there. Both developers and website owners need to accept that things will eventually break if you run on old PHP versions.

New features (for develoeprs)

Most website developers would prefer to work with the newer versions of PHP whenever this is possible, because many new features are added between the PHP 5.2 and PHP 7.4 versions. These changes go a long way towards making the latest version of PHP, faster and more secure while providing additional flexibility to build better solutions.

How to check the PHP version of my WordPress website?

Checking the PHP version your website utilize is very easy. You can try any of the methods below.

See the control panel of your hosting provider

Nowadays most of the hosting providers are using cPanel as control panel. With cPanel it is very easy to check the PHP version, access the control panel and navigate to “MultiPHP Manager” and you will see the version. If you are with cPanel but don’t see the “MultiPHP Manager” option, most probably your hosting provider is also using CloudLinux, in this case search for “Select PHP Version” icon. Another option is to ask your hosting provider support team for information about the PHP version your website is running on.

Use the phpinfo() function to determine the PHP Version

Another easy way to determine the PHP version your website is running on is to create a file with the phpinfo() function on the server or on your local device and then upload it to your web hosting using an FTP. You can use any text editor, like notepad, to create this file. After you open a new file, paste the provided below code in the file and save it. The code you need to paste in the file is:

<?php phpinfo(); ?> //Let's check the PHP version

Save the content to the file named phpinfo.php and upload it to your web hosting. After you have uploaded the file, visit your website, and add the name of the file after the domain name. The link in the address bar of your browser would look similar to ­– http://mywebsites.com/phpinfo.php. Just remember to place your actual domain name instead “mywebsites.com”. The PHP version will be show on the screen almost instantly.

Check PHP version in WordPress

If you are running WordPress 5.0 or above, you can see the PHP version under the Tools > Site Health tool.

The PHP version my website runs on is old. Should I just update it? Is everything gonna be alright?

These are excellent questions, unfortunately, there is no simple “Yes” or “No” answer to them. For example, if your website is old, or the PHP version that your website runs on is below PHP version 7.x you will need to test the whole website and make the necessary changes required to ensure that it is compatible with the latest version of PHP. The developer of your website, or your own team of developers, should be able to provide you with an idea of the scope of work required to update your website code. If your website use an ecommerce platform or a CMS platform like WordPress, updating it may involve checking each of the plugins used by the website, the theme and the version of WordPress itself. This is needed to ensure that all of them are compatible with the updated PHP version. Although some plugins or themes may not be compatible if they are with dropped support. Have in mind that there are many other plugins available that you could use to replace the incompatible components.

Conclusion

Using the latest PHP versions is important not only for security reasons but also for better performance and support. So there is no better time than now to think about upgrading to PHP 7.4, if you haven’t already. Not only because you want your website to be running on supported software, but you will also have guaranteed performance benefits!  If your current WordPress web host doesn’t support PHP 7.4 yet, we strongly encourage you to seek out new hosting. And likewise with themes and plugins. We at WPCacheOn have performed thorough tests to ensure that our plugin is fully compatible with PHP 7.4. Using the latest technologies, we ensure more speed for your WordPress website.

Leave a Reply

Your email address will not be published.