Last Updated on by Vairo Kremanis
According to almost everyone, PHP 7.2 is (not surprisingly) now the recommended PHP version for WordPress. In fact, the WordPress team itself recommends that you use PHP 7.2 for optimal performance, and to make your WordPress site as stable as possible.
But as far as PHP is concerned, how good is 7.2 when you really put it under a microscope? Is it really a good choice for WordPress?
In this article, these are the main questions that we are going to be answering. But first, let’s do a little bit of catching-up.
What Is PHP?
PHP is an open-source, general-purpose scripting language. It is predominantly used in creating web pages, can be embedded in HTML code, and can be used across many different types of platforms. PHP technically stands for “Hypertext Preprocessor,” despite the fact that the acronym does not quite add up. PHP used to stand for “Personal Home Page” back in the day, but now, it stands for the recursive acronym: “PHP: Hypertext Preprocessor.”
It can be used on platforms like Mac OS X, Microsoft Windows, Linux, many different variations of the Unix system… almost any platform that you might want to use. It is used for server-side scripting, for writing desktop applications, and for accessing databases.
In fact, PHP has long been known for its superior strength in the ‘accessing databases’ category. It can access more than 20 different types of databases, and can be used to output images, Flash movies, and PDF files from your website, etc.
But if you are a web developer with any WordPress or PHP experience, you probably already know this. You probably also know that WordPress still supports PHP 5, but that the PHP project has continued to evolve since then. It got a big update when PHP 7 came out, and got some pretty awesome new features when PHP 7.2 was released.
So let’s take a moment to talk about some of those features.
New Features On PHP 7.2
PHP 7.2 was officially launched in November of 2017, so it has now been out for quite a little while. It features some new functions and improvements that are of particular interest to WordPress users, most of which focus on security improvements, new usage features, and performance enhancements.
First of all, the Libsodium application-layer cryptography library used to be made available through PECL, but it is now included as a part of the core in PHP 7.2. This actually makes PHP the very first programming language, of all time, to add a modern cryptography to the standard library—which is quite awesome.
Argon 2 is now included as a hashing algorithm, which is pretty cool.
PHP 7.2 is also said to run about 13% faster than 7.1 did, which is a pretty big performance boost. It is also said to run about 20% faster than 7.0, and 250% faster than PHP 5.6!
But what is even more amazing is that about 4 out of 10 WordPress users still haven’t updated from PHP 5.6… which kind of blows our minds a little bit… but it is what it is.
Support is also an issue to be discussed where 7.2 is concerned. 7.0 will reach the end of its critical support toward the later part of 2018, and PHP 7.1 will not be supported either after December of 2018. So if you wish to continue getting support for your version of PHP, you will obviously have to upgrade before then (though why wouldn’t you want to?).
Migrating to 7.2 is also a pretty pain-free experience, for the most part (at least, it is if you are migrating from 7 or 7.1).
But now that we have talked about some of the core functions and improvements in 7.2, let’s talk about how WordPress performs with it.
How Does WordPress Perform On PHP 7.2?
First of all, WordPress.org refers to PHP version 7.2 as their default version of PHP. They recommend in their host requirements that you find a host that supports…
- PHP version 7.2 or greater
- MySQL 5.6 or greater, or MariaDB 10.0 or greater
- HTTPS support
They also say that they recommend Apache or Nginx as servers, but they also go on to say that any server that supports PHP and MySQL will do (source).
They also say, further down on the page, that WordPress works with PHP 5.2.4 or greater, but that these versions have reached official end of life… and as such, may expose your site to security vulnerabilities.
So this is the first thing to understand about PHP 7.2. WordPress.org, along with pretty much everyone else who uses or develops within WordPress, recommends 7.2 as the new standard.
And there are many good reasons for this.
In general, PHP 7 itself brought about major changes in pretty much four major areas. These were…
- Performance
- Refactoring
- Cleanup
- Type System
In fact, companies like Badoo actually saved a lot of money when they switched from PHP 5 to PHP 7. According to one statistic, it was estimated that Badoo saved about one million dollars just from switching to the upgraded version of PHP, mostly because they were able to answer requests faster, and because doing so required less server power.
The upgrade to PHP 7 has also been rather affectionately referred to as ‘green IT,’ because the upgrade reduces the load on servers for major companies to such a degree that you could actually say that it is even ‘good for the planet!’
But when you ask the question “what specifically do you need to know about the upgrade to PHP 7.2,” it turns out that the answer is actually a pretty simple one. In other words, if you are familiar with PHP 7, then you will already know most of what needs to be known about PHP 7.2.
PHP 7.2 was actually a pretty minor release when you compare it to 7.1, especially when you compare it to the changes that occurred between versions 5 and 7. In fact, some have gone as far as to say that it is a pretty ‘boring’ software release, when you consider everything… not because it is not a good upgrade, but because this version of PHP has just gotten so mature that it isn’t really that ‘exciting’ or dramatic.
In other words, PHP 7.2 is a very modern, and professional, realization of what PHP has been doing for years.
In Conclusion
Without getting incredibly technical, it would be more than fair to say that PHP 7.2 is definitely an improvement—though it is not exactly groundbreaking. But perhaps most importantly, some of the changes that have been made between 7 and 7.2 do more to give us a reason to move away from PHP 5 than anything else—and that is actually pretty important.
In a world where so many people are still running PHP 5.6 with their WordPress, maybe these reasons will be enough to compel them to move forward and migrate to a newer version.
The migration process itself, as stated before, is not painful. But that was meant in the context of updating from an earlier version of 7 to 7.2. If you are migrating all the way back from a version of 5, then be aware that there are definitely a few ‘breaking changes’ that may affect your WordPress site.
We have heard some people say that the migration process is better done in steps, moving through the different versions slowly and fixing the problems as they arise. This can be an especially useful way to go if you are still running an older version of 5.
But the most important thing to keep in mind is this… that upgrading to PHP 7.2 is going to increase WordPress performance by a significant margin and increase your security, especially if you have yet to upgrade to 7. It is also going to keep you current with support, and that is super important.
We managed to score 100 score on Pingdom website speed test tool for the first time when doing some other tweaking at the same time.
If you are not a programmer, then some of what you might hear about PHP 7.2 is probably confusing. But if you run a WordPress website, it could certainly be to your benefit to read up on how to use PHP with your site, because eventually your site will suffer (at least to a certain extent… that, or you will find yourself severely limited) if you don’t at least get a little more comfortable with using it.
And of course, if you are planning to freelance at all within the WordPress community, it almost goes without saying that PHP is an essential skillset to master. You should at least have a working knowledge of it before trying your hand at WordPress development, as it is currently use by a wide majority of websites on the internet, especially among content management systems that are popular with non-technical people (aka, WordPress).
So yes. WordPress performance on PHP 7.2 is awesome. Perhaps not the kind of awesome that one would expect from the update, but the kind of awesome that would definitely inspire one to finally update to the latest version… especially if you are still running an older version of 5… which in this day and age, is just becoming more and more ‘ancient,’ as the updates stack up.