You may not know it, but if you have a WordPress website, your site is running PHP right now. In fact, you may not even know what PHP is, how to check what version your website is currently using, or why it’s important to have at least a basic understanding of which WordPress PHP version your website’s host is currently running!
Since PHP runs on the backend of your WordPress website and helps you build fully functioning websites from the ground up – without manually editing any code – there really isn’t much you need to know about PHP unless you delve into web development or care about your website's speed and security.
That’s because your WordPress website, and all of the added themes and plugins you install, run PHP script language quietly in the background while you make your site look and function the way you want it to, without having any technical knowledge.
Pictured above: Actual footage of PHP doing its thing.
However, if you are looking to improve the overall performance of your WordPress website (which all website owners should make an effort to do) it might be a good idea to learn a little about PHP and what versions your site has compatibility with. That’s why today I am going to answer the following questions:
- What is PHP?
- How does PHP differ from HTML?
- Which PHP version is the most current?
- Why is PHP crucial to your website’s performance?
- How can I perform a WordPress PHP version check?
So, let's get started!
Free PHP Security eBook
[4 Pages] The 21-Step Checklist to
Ensure a 99.9% Secure WordPress Website
What is PHP?
PHP is the most popular server-side script language used today.
Not sure what server-side means?
In short, server-side means that the action is taking place on the website owner’s computer, rather than the site visitor’s computer. So, when it comes to PHP scripts (or files), any functionality the script language is going to execute for your site visitors will happen on your end, using your server, and your resources.
Though primarily used for web development, PHP also serves as a general-purpose programming language. It sits at the core of the world’s most widely used blogging platform (WordPress!), it is powerful enough to run the world’s largest social network (Facebook!), and it is easiest enough for even novice website owners to learn should they want to.
When someone clicks on your website or types in your site’s URL, their browser contacts your website in search of your server. Your server is responsible for storing, processing, and delivering your site’s web pages to visitors.
When the server location is found, your website then contacts your hosting provider (the one who owns the server that stores and delivers all of your website’s data to site visitors).
Using specialized PHP code, your host then contacts the main database (such as MySQL) where your website’s data is stored in separated parts.
From there, the main database takes your host’s request for your website, compiles it into readable HTML or HTML5 format, and sends it to your site’s server, where it is then delivered to your site visitor’s computer as a visible web page.
HTML versus PHP
If you are not familiar with PHP, there is a good chance you are equally unfamiliar with the term HTML. And while the two do work together to make your dynamic, ever-changing website available to site visitors, I think it’s a good idea to understand their differences.
Especially since I mentioned that PHP turns your website pages into readable HTML or HTML5 format when a site visitor requests to see your website.
Basically, HTML allows you to place images, text, videos, and other pieces of content together into a visually appealing webpage. Anything that your site visitors can see or read on your website is being presented to you using HTML.
PHP, on the other hand, is a server-side script language that works on the backend of your website. It is responsible for making your website function, especially in a dynamic way. It builds upon HTML and helps present your website’s images, text, videos, and other pieces of content to site visitors.
In the end, PHP makes your website do stuff.
The Different Versions of PHP
As with most things web-related, PHP has had its fair share of changes over the years. And, while you are probably not interested in knowing the full history of PHP versions, I will cover the basics so you can have a good understanding of how PHP got to where it is now.
To start, in order for your WordPress website to function properly, your host must, at the very minimum, support PHP version 5.2.4. However, the official WordPress website will always recommend you run the highest available PHP version, which is PHP 7.
Notice the breakdown of PHP versions currently being used by WordPress users. As you can see, the majority of users are running PHP 5.6, which is one step below the coveted PHP 7.
So how did we get from PHP 5.2.4 to PHP 7+?
- PHP 5.2. This PHP version was released in August 2007 and is the minimum requirement for all WordPress websites. In fact, you’d be hard-pressed to find any hosting company offering users anything less, since WordPress won’t work on any lower versions. It is full of security issues, most WordPress plugins will not support this version, and you should definitely upgrade if you find your website is using this PHP version.
- PHP 5.3. Notably, a huge step up from version 5.2, this PHP version is still widely supported, though most developers are probably not developing products with it since the code is not as clean, secure, and solid as higher PHP versions.
- PHP 5.4. In response to PHP 5.3’s end-of-life in August 2014, version 5.4 quickly became one of the most supported PHP versions around. In addition, it boasted the best speed improvements to date and used far less memory than any other version, making it (still) quite popular amongst WordPress users.
- PHP 5.5 and 5.6. These two versions are one step below the coveted PHP 7 and are currently used by over half of all WordPress users. This is because they are still in good working order, all high-quality hosting providers have these versions, and many people are still making the shift from versions 5 to 7.
PHP Version 7
In late 2015, PHP 7 was released and touted as being the best version to date – complete with a new version of the Zend Engine (the open source, scripting engine executing PHP files) and plenty of new features such as:
- Abstract Syntax Tree
- Consistent 64-bit support
- Improved Exception hierarchy
- Removal of old and unsupported SAPIs and extensions
- Anonymous Classes
- Zero Cost Assets
But that’s not all…
Main Features of PHP 7
Launched as the most optimized PHP version to date, PHP 7 offers WordPress website owners 5 major features:
1. Optimal Speed
PHP 7 is up to twice as fast as any previous PHP version and requires fewer servers to deliver your website to the same number of site visitors. In fact, benchmark testing shows that PHP 5.6 executes one WordPress request in just under 100M CPU instructions, while PHP 7 does the same using 25M CPU instructions.
Free PHP Speed eBook
The 12-Step Checklist to
Achieve Loading Times Under 1 Second
2. Type Declarations
With the implementation of type declarations, PHP no longer automatically sets variables. By allowing you to assign data types to variables, you ensure perfect outcomes (as opposed to the possible errors PHP may create by automatically setting variables for you). In addition, this makes your code much easier to read. This is especially helpful for web developers building websites from scratch.
3. Error Handling
Before PHP 7, handling PHP script errors were nearly impossible. When an error did occur, it would simply stop the script (possibly invoking the white screen of death) rather than calling on the error handler to help. The error handler is a specialized program that anticipates, detects, and resolves errors such as the ones PHP scripts can run into.
If done properly, the error handler can stop and resolve an error without terminating the application. If termination of the application is necessary, the error handler then makes note of the error in a log file.
Although PHP 7 does not guarantee your site visitors will never encounter errors, the chances of the user experience being interrupted because of PHP script errors are drastically reduced.
4. Spaceship Operator
$compare = 2 <=> 1
2 < 1? return -1
2 = 1? return 0
2 > 1? return 1
One of the newest operators to be added to PHP 7 is the Spaceship Operator. Comparing values on the left with values on the right, and providing a greater than, less than, or equal to value helps tremendously when it comes to sorting functionality.
5. CSPRNG Functions
As a way to generate random data (for things such as passwords), PHP 7 toughens security so that your site and all of its sensitive data is not as vulnerable to hackers. This is done by putting a system interface to the operating system’s random number generator for added security. If your operating system gets hacked, you have bigger issues to worry about besides your random numbers.
Why is PHP important to WordPress?
Okay, so now that you have a solid grasp on what PHP is and what the latest version of PHP looks like, let’s take it one step further and see why PHP is so important for your WordPress website:
- Functionality – delivers dynamic web pages to site visitors
- Ease of use – easy for beginners to learn and edit
- Control – gain maximum control over your website with only a few lines of code
- Cost efficient – open-source and free to use
- Popular – most quality WordPress hosting providers will have current versions available
- Scalable – reliable as your site grows to many web pages
- Community Based – popularity lends lots of community support
- Versatile – works with Windows, MacOS, Linux, or UNIX
- Fast – uses its own memory, saving on your server resources and increasing page speeds
- Secure – built-in security layers help protect against viruses and threats
In the end, PHP has been used for many years and is trusted by most web developers in both their personal and professional projects.
And, as the PHP versions continue to improve, it becomes even more apparent that WordPress users should take advantage of everything the newest PHP version has to offer.
How to Perform a WordPress PHP Version Check
Since it’s critical to your WordPress website’s overall speed and performance to use the highest PHP version to date, it is a good idea you run a WordPress PHP version check on your website to see which version your current host is running.
Luckily, checking your WordPress PHP version is easy to do using the free Display PHP Version WordPress plugin.
How to Use Display PHP Version to Check Your WordPress PHP Version
Display PHP Version is a simple WordPress PHP version checker plugin. In addition, to use it all you have to do is install and activate it on your WordPress website.
To start, navigate to Plugins > Add New in your WordPress dashboard. Next, search for Display PHP Version.
Click Install Now and then Activate to get the plugin ready for use on your website.
Display PHP Version is now ready to reveal to you which PHP version your host is currently running. Simply navigate to Dashboard and click on the At a Glance section. You will see something like this:
As you can see, my test website, which is also connected to my personal website, is currently running PHP 5.5.38. While this is acceptable, it is not the best my website can do.
Remember, ⏩ PHP 7 is nearly 2x faster than any previous PHP versions, PHP 5.5 included. Click To Tweet This is why I should consider updating my host’s PHP version to improve my website.
However, before making the big switch (after all PHP 7 is a huge step up from any previous PHP 5.x versions) it would be wise of me to make sure that all of my current themes and plugins are compatible with PHP 7 before upgrading.
Let’s look at an easy way to do that…
How to Check PHP 7’s Compatibility With Your Plugins and Themes
If you notice that your WordPress hosting provider is not running PHP 7, but has it available to its users, you may want to consider making a WordPress PHP version change so you can benefit from all of PHP 7’s features. However, in order to avoid breaking your site, you should make sure all of your site’s themes and plugins are compatible.
To check for WordPress PHP version compatibility, you can use another simple plugin called PHP Compatibility Checker.
An Overview of PHP Compatibility Checker
The popular hosting company WP Engine created PHP Compatibility Checker in an effort to help the WordPress community adapt to major PHP shifts. Designed to work on all WordPress websites, regardless of which hosting provider is being used, PHP Compatibility Checker checks your website’s theme and plugin code and presents any compatibility issues to you.
Any issues the plugin detects are categorized into errors and warnings. The list of WordPress PHP version errors and warnings will include the file and code line number that is causing issues so you know exactly where the problem is.
In addition, you will notice suggestions for why the code is incompatible with the current PHP version, as well as which themes and plugins may benefit from an upgrade in order to become compatible with higher PHP versions.
Using the PHP Compatibility Checker Plugin
Just like Display PHP Version, navigate to Plugins > Add New and search for PHP Compatibility Checker.
From there, simply click on Install Now and then Activate. You will then notice a new menu item in your WordPress dashboard labeled PHP Compatibility under the Tools section. Click on that to configure the plugin to scan your website for compatibility issues.
Once you click on PHP Compatibility, you will have the option to scan your website for compatibility with the PHP versions 5.3, 5.4, 5.5, 5.6, and 7.0. You also have the option to scan all themes and plugins installed on your website or restrict your scan to only those themes and plugins that are active on your site.
In this case, I will scan my website for compatibility issues with PHP 7, and will narrow the scan to active theme and plugins.
After clicking on Scan site, the plugin presents me with scan results:
Luckily for me, my active theme, and all active plugins are compatible with PHP 7. This means that I can make the switch from PHP 5.5.38 to PHP 7 with no problems. And the truth is, so long as you use high-quality themes and plugins, and keep everything up-to-date, this should be the case for most WordPress users.
WP Engine does want to make sure that you know that their plugin is not foolproof. In fact, they provide a list of plugins that are likely to provide false positives (meaning these plugins may come up as having WordPress PHP compatibility issues, when in fact there are no actual issues):
If you find the PHP Compatibility Checker reporting issues related to any of the above-mentioned plugins, check out the details and see if the error or warning is a result of an issue with the compatibility plugin, rather than the plugin being scanned.
Free PHP Security eBook
[4 Pages] The 21-Step Checklist to
Ensure a 99.9% Secure WordPress Website
In the end, PHP is a crucial part of your WordPress website, whether you know it or not.
Not only does PHP itself make your website run properly, help HTML display as you want it to, and ensure fast loading speeds and efficient overall site performance, higher PHP versions build upon those benefits.
It is essential that your WordPress website run on the highest PHP version made available to you. This means that if you run a WordPress PHP version check on your website, and come up with anything lower than a PHP 7.0, and your host provider offers PHP 7, it is time you think about making the switch.
However, always remember to make sure you check the PHP version compatibility of your website’s themes and plugins before making such a substantial switch. After all, a broken site is far worse than a website that is running on PHP 5.x!
Want to give your feedback or join the conversation? Add your comments 🐦 on Twitter.