If you have a WordPress site, it’s currently running PHP. In fact, it couldn’t exist without it. Considering it plays such a pivotal role in your site’s functionality, it’s important to know which PHP version you’re using.
PHP lets you build a dynamic, fully functioning WordPress site without technical knowledge or manually editing code. However, if you’re looking to improve the overall performance of your website, it’s helpful to learn which PHP version your site currently uses and is compatible with.
In this post, we’ll discuss what PHP is, why it’s so important for your website’s performance, and the current versions available. Then we’ll walk you through how to check your PHP version in WordPress. Let’s get started!
In This Article 👁
- What is PHP?
- Why Is PHP Crucial for Your Website’s Performance?
- An Overview of the Role and History of WordPress PHP Versions
- Which Version of PHP is the Most Current?
- How to Check Your PHP Version in WordPress (3 Possible Methods)
- Frequently Asked Questions (FAQs)
- Wrapping Up
What Is PHP? 👩🏫
PHP stands for Hypertext Preprocessor. It’s the most popular server-side script language used today:
In short, ‘server-side’ means that the action is taking place on the website owner’s computer, rather than that of the site visitor. So, when it comes to PHP scripts (or files), any functionality the language executes for your users happens on your end, using your server and its resources.
Although it’s primarily used for web development, PHP also serves as a general-purpose, open-source programming language. It’s powerful enough to run Facebook, the world’s largest social network, and sits at the core of WordPress, the world’s most widely used Content Management System (CMS).
How Does PHP Work?
When someone clicks on a link to your website or types in its URL, their browser contacts your site in search of your server. Your server is responsible for storing, processing, and delivering your webpages to visitors:
Once the server is found, it delivers your website’s data to your visitors. Using specialized PHP code, it contacts your site’s main database (such as MySQL) where your website’s data is stored in separate parts.
From there, the main database takes your server’s request for your website, compiles it into readable HTML or HTML5 format, and sends it to your site visitor’s computer as a visible webpage.
How Does PHP Differ from HTML?
If you are not familiar with PHP, you may also be unfamiliar with the term HTML, or Hypertext Markup Language. While the two do work together to make your dynamic, ever-changing WordPress site available to visitors, it’s helpful to understand their differences.
HTML can be described as the basic layout and structure of your website content. It enables you to place images, text, videos, and other pieces of content together to create a visually appealing webpage. Basically, anything your site visitors can see or read on your website is presented using HTML.
However, unlike PHP, HTML cannot perform computations, such as 1+1 = 2. PHP is a server-side script language that works on the back end of your WordPress site.
As you might recall, PHP turns your website pages into a readable HTML format when a visitor requests to see your website. PHP builds upon HTML and is responsible for making your website function, especially in dynamic ways.
Why Is PHP Crucial for Your Website’s Performance? ⚡️
So far, we’ve discussed what PHP is and how it works. However, let’s take a minute to address why it’s so important to WordPress.
As the server-side programming language of WordPress, PHP is central to your site’s performance. It is used to write WordPress itself, as well as plugins and themes, and provides the functionality needed to deliver dynamic webpages to your site visitors.
There are many different ways PHP influences WordPress site performance. For example, it can:
- Help keep your site scalable and reliable as it grows and you add more webpages.
- Affect how fast your site is by using its own memory and saving your server resources to increase page speed.
- Protect against viruses and threats through its built-in security layers.
PHP runs on your web server. Therefore, any issues with your PHP – which can hurt site performance – are your responsibility to fix. One of the biggest causes of errors that stem from PHP is that your site is running an outdated version.
An Overview of the Role and History of WordPress PHP Versions 📖
WordPress core, theme, and plugin developers are constantly releasing updates to fix bugs and add new features and functionality. Similarly, PHP is continuously being improved.
New iterations of PHP typically involve a variety of upgrades, often related to performance, compatibility, and security. For example, this may include:
- Cleaner code that is easier to read and support
- Process improvements for handling errors and resolving script problems
- Security fixes to help make your site less susceptible to hackers
PHP has had its fair share of changes over the years. While it’s not necessary to cover its full history, knowing the basics can help you understand where the language is now.
Here’s a quick look at the WordPress PHP version timeline:
- PHP 5.2 was released in August 2007 and is the minimum requirement for all WordPress websites. It’s full of security issues, most plugins don’t support this version, and you should definitely upgrade if you find your website is using it.
- PHP 5.3 was a huge step up from version 5.2. While it’s still widely supported, most developers are probably not creating products with it since the code is not as clean, secure, or solid as more recent versions.
- PHP 5.4, in response to PHP 5.3’s end-of-life in August 2014, quickly became one of the most supported PHP versions. Additionally, it boasted major speed improvements and used far less memory, making it popular amongst WordPress users.
- PHP 5.5 and 5.6 are a step below the coveted PHP 7 and still used by many WordPress users. They’re in decent working order and provided by most high-quality hosts.
As you can see, with each PHP iteration comes some improvements to make it better than before. However, the most notable update was the release of PHP 7.
The Advantages of PHP 7
In late 2015, PHP 7 was released and touted as being the best and most optimized version to date, complete with a new version of the Zend Engine (the open source, scripting engine that executes PHP files).
It included 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
What’s more, PHP 7 is up to twice as fast as any previous version and requires fewer resources to deliver your website to the same number of 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:
Some of the additional PHP 7 features include:
- Type Declarations. By assigning data types to variables, you ensure perfect outcomes. This makes your code much easier to read and is especially helpful for developers building websites from scratch.
- Error Handling. Before PHP 7, handling script errors was nearly impossible. The new error handler anticipates, detects, and resolves issues without terminating the application. If termination of the application is necessary, it makes note of it in an error log file.
- CSPRNG Functions. As a way to generate random data (such as passwords), PHP 7 toughens security so your site and all of its sensitive data are not as vulnerable to hackers. This is done by putting a system interface to the operating system’s random number generator for added security.
Put simply, the PHP version you’re using affects your site’s compatibility with WordPress. Upgrading to the most current version of PHP can help enhance your site’s security, speed, and overall performance and functionality.
Which Version of PHP is the Most Current? 🕰
In order for your WordPress website to function properly, your host must, at the very minimum, support PHP version 5.6.2. However, the official WordPress website will always recommend you run the highest available PHP version, which, at the time of this writing, is PHP 7.4.
As we touched on in the previous section, the most current version of PHP recommended by WordPress doesn’t necessarily mean it’s the only version used. For example, in the chart below you can see a breakdown of WordPress PHP version adoption and usage:
As you can see, the majority of users are running PHP 7.0 or higher. However, only a chunk of them have upgraded to PHP 7.4 and even more still use PHP 5.6.
It’s worth noting that, although WordPress and PHP work in parallel, they are separate in terms of version releases and updates. In other words, just because you install the latest WordPress update doesn’t necessarily mean you’re using the most recent PHP version.
Your server determines which PHP version your WordPress site uses. Most quality hosting providers will have the current PHP version available.
However, some still use older versions as the default. The main reason for this is that new PHP versions can sometimes deprecate certain functions, which can cause compatibility issues and break older themes and plugins.
However, best practice is to always keep your themes and plugins updated. Sticking to products that receive regular updates and maintenance can translate to a more secure WordPress site. Plus, it reduces the risk of running into a PHP compatibility issue.
How to Check Your PHP Version in WordPress (3 Possible Methods) 🔍
Since it’s critical to your WordPress website’s overall speed and performance to use the highest PHP version to date, it’s smart to run a WordPress PHP version check on your website. This will let you see which version your host is currently running and determine whether it may be time to update to a newer version.
Traditionally, using a plugin such as Display PHP Version or PHP Compatibility Checker was a popular method for performing a WordPress PHP version check. However, neither plugin has been tested with the last few WordPress releases, nor have they been updated in at least a year. Therefore, they may not be the safest options.
Fortunately, there are a handful of other methods you can use. Let’s take a look at three ways to check your PHP version in WordPress:
1. Use the WordPress Site Health Tool from Your Dashboard
The quickest and easiest way to check your PHP version in WordPress is to do so directly from your dashboard. First, navigate to Tools > Site Health:
On this page, you can view the health status of your WordPress site as well as any available updates or recommended improvements. If you’re using an outdated PHP version, it will be listed here. Select the Info tab:
Next, click on the arrow to expand the Server section. This will provide you with a handful of details regarding your server setup, including your PHP version:
If, for whatever reason, you’re unable to access your admin dashboard, don’t worry. There are two other methods you can use.
2. Look In Your Hosting Control Panel
Another way you can check your WordPress PHP version is through your hosting account control panel. This is a simple, safe, and quick method that doesn’t require you to touch any of your site’s files.
Every quality hosting provider will list your PHP version somewhere in your control panel. If it’s not clearly labeled, you may just need to refer to the specific documentation of your web host.
If your hosting provider uses cPanel, first log in to your hosting account and open it. Under the Software section, click on Select PHP Version:
At the top of the page that opens, you can see which PHP version you’re currently using:
When you click on the dropdown button, it also presents a list of PHP versions your hosting provider supports. This is where you could go to change your PHP version as well.
3. Create and Upload a PHP File to Your WordPress Directory
If you don’t have access to cPanel or can’t locate the PHP version information from your hosting dashboard, another option is to use a PHP file. This method is a bit more technical than the previous two. However, it’s still relatively quick and easy.
First, open your computer’s text editor (such as Notepad) and create a new file named phpversion.php. Within that file, place the following line of code:
<?php phpinfo(); ?>
After you save the file, connect to your server using File Transfer Protocol (FTP) via an FTP client. You can also use your host’s File Manager.
In the root directory of your WordPress site (/public_html), upload the phpversion.php file:
Once the file is uploaded, you can view it in your web browser. To do that, enter yourwebsitedomain.com/phpversion.php into the address bar. (Of course, replace ‘yourwebsitedomain.com’ with your actual WordPress site URL.)
This will open a window that displays detailed information about your PHP version:
For security purposes, we recommend deleting the phpversion.php file from your directory once you’re done.
Frequently Asked Questions (FAQs) 📝
If you visit your WordPress site and everything appears to be functioning and displaying as it should, your PHP is likely working. However, if there are any issues or an update is required, you can find them listed under the Site Health tool from your WordPress dashboard.
Also, to ensure a PHP version works with your site, it’s important to check the PHP compatibility of your themes and plugins. For this, you may want to use a plugin such as PHP Compatibility Checker. Once installed, it will display errors and warnings related to your PHP version and WordPress compatibility. However, as we mentioned earlier, this plugin hasn’t been tested with the latest versions of WordPress.
The minimum PHP version that is compatible with WordPress is PHP 5.2.6. Although your host may offer this as an option, it’s not necessarily the best or safest. Other PHP versions compatible with WordPress are PHP 5.3 – 5.6 and PHP 7 and higher. WordPress recommends using PHP 7.4.
Wrapping Up 🎀
PHP is a crucial part of your WordPress website that helps it run properly and ensure efficient overall site performance. It’s highly recommended that your WordPress site runs on the latest version of PHP available, which is currently PHP 7.4.
In this post, we explained three ways you can check your WordPress PHP version:
- Use the WordPress Site Health tool from your dashboard.
- Go through your hosting control panel to view the current PHP version.
- Create and upload a PHP file to your WordPress site’s root directory.