How to Check Which Version of PHP You’re Using
Why being on the latest version of PHP matters and how to check what version you’re on
Every website has at least one thing in common—it runs on code.
PHP, which is short for Hypertext Preprocessor, is an open source scripting language that’s been a steady fixture on the server-side of WordPress development since WordPress was launched in 2003.
Most of the things you see on both the front and back-end of your WordPress site exist thanks to PHP. Not only is it found across your post and page templates, but PHP also makes up the files that build the WordPress dashboard.
As newer versions of PHP have been released, it’s arguably become more important as a powerful framework for building sites and improving performance, but running an up-to-date version of PHP is key to realizing those results.
50% of WordPress sites run a PHP version that is already end of life, meaning it’s no longer supported or patched for security vulnerabilities.
In this post, you’ll learn more about PHP and why it’s important to run the latest version, how to check which version of PHP your site is running, and how to upgrade it safely. Ready to get started? Let’s dive in!
Server-Side Code 101: What is PHP?
PHP is an open source programming language that plays a central role in the traditional open source LAMP Stack. As such, it’s a foundational element found behind the scenes on many WordPress sites.
Depending on your hosting provider and the server resources you have provisioned, problems with PHP (like not running an up-to-date version of the code) could be slowing you down, no matter how much you’ve tried to optimize your site.
While PHP is widely used as a central component of WordPress, it also needs to be updated to ensure it’s powering your site, not slowing it down.
The Benefits of Updating PHP
Given the importance of PHP to WordPress, running an up-to-date version of PHP can have a major impact on the overall performance of individual WordPress sites.
In a nutshell, PHP pulls the correct data from your database, wraps it in HTML and CSS, and then delivers it to your visitor’s browser. If any part of this process is slow, so too is everything else, and your users will be the first to notice.
While updating your PHP will help ensure it’s running smoothly, new versions are also supported by a team of PHP developers from around the world who maintain, update, and make fixes to the language in stable version releases.
Currently, each PHP version is supported for two years after its initial release, meaning improvements, bug fixes, and security patches are all routinely addressed. After the first two years, PHP versions only receive critical security updates, and after three years, PHP versions are deprecated and no longer receive updates at all.
As noted above, half of all WordPress sites are running a version of PHP that has already been deprecated, meaning it’s no longer supported or patched for security vulnerabilities.
Optimizing your site for performance AND security is where updating PHP comes into clear focus. Like WordPress, PHP has become more advanced through many years of website development and real-world use cases. New versions continue to evolve, and there have been numerous updates as well as full releases since the 1.0 launch (in 1995!).
To run WordPress, your server needs to use at least PHP version 5.2.4, however, PHP 7.4 or higher is the standard recommendation.
That’s because, like WordPress, new versions of PHP offer improvements for site speed, security, and overall efficiency. As it’s progressed, PHP has only become faster, more secure, and less resource-hungry than its previous iterations.
We’ve seen this first hand at WP Engine, where customer upgrades to new versions of PHP often result in a decrease in server request processing times and faster site speeds.
We work hard to ensure our customers have access to the latest versions of PHP, and we typically make those versions available after we’ve completed necessary testing at scale for all of our customers’ sites.
How to Check Your WordPress Site’s PHP Version
How do you figure out which version of PHP your site is currently running on? If you want to know which version of PHP currently powers your WordPress site, there are a few ways to find out:
Use the WordPress Site Health Tool
For users running WordPress version 5.2 and above, one of the easiest ways to determine which version of PHP your site is using is through the WordPress Site Health tool, which provides a ton of helpful information about your WordPress sites (not just PHP).
While the Site Health Status page will provide an overview of your entire site recommend a PHP update if your current version is out-of-date, you can quickly check which version of PHP you’re using by navigating to the Tools > Site Health > Info page in the WordPress dashboard and opening the Server tab. You should see the following:
In addition to server architecture and web server information, this screen will tell you which version of PHP you’re currently running, it will identify your PHP SAPI (the Server API, SAPI your PHP is using), and tell you what your PHP max input variables are (by default, the maximum number of input variables allowed for PHP scripts is set to 1000).
Run a PHP File (DIY)
If you have access to your own server, you can check your PHP status by running a simple PHP file. Just add the following to a blank PHP file and run it on your server:
<?php phpinfo() ?>
Or, if you’re using a locally installed version of PHP, use the following:
That should provide information about which version of PHP you’re currently using, when it was created, copyright data, etc. However, not everyone has the know-how, time, or access to run files on their own server.
Check With Your Hosting Provider
If your WordPress site is hosted with a provider, you should be able to easily identify which version of PHP your sites are using. If it’s not readily apparent, you may need to reach out to your provider for help.
WP Engine makes it easy for customers to view all of their PHP information through the PHP Selector tool, which shows you the current version of PHP your site is using and provides easy options for updating PHP.
Tired of worrying about PHP? We’ve got that covered!
Use a WordPress Plugin
Another option is to tap into the wide world of WordPress plugins for help finding out more about your PHP. Display PHP Version is a solid WordPress plugin that gives you the ability to see your current PHP version under “At a Glance” in your WordPress admin dashboard.
If you are indeed running an up-to-date version of PHP, you’re in good shape, but for those with out-of-date PHP, or those who want to know how to update their PHP when the time arises, the next section is for you.
How to tell if you’re on a version of PHP NOT patched for security vulnerabilities
As noted above, PHP versions are supported for two years after initial release, which means general improvements, bug fixes, and patches for security vulnerabilities are all routinely addressed and updated. After two years, however, PHP versions will only receive critical security updates, and after three years, PHP versions are fully deprecated, meaning they no longer receive updates at all.
While tools like the WordPress Site Health feature will tell you if your PHP is out of date, you can use the detailed PHP version information found here to determine exactly what type of support each version of PHP currently receives, or if it’s still being supported at all.
How to Safely Upgrade Your PHP
Upgrading your version of PHP is not particularly complicated, although, like any software update, there are some risks involved.
The biggest risk is centered around backward compatibility or the possibility that code on your site (in WordPress core, themes, plugins, and scripts) is not compatible with the new version of PHP you’re upgrading to.
If that is indeed the case, all or parts of your site might break or experience significant performance problems once you make the switch. That said, there are ways to check compatibility issues before you update your PHP, which are outlined below.
Before you jump in, the process described here is for upgrading your live website. An even better option is exploring local development, which allows you to create a local copy of your site and run it on your computer. It’s hands down the best (and safest) way to test new code on your site, and upgrading to a new version of PHP is no exception!
With that, here’s how to safely upgrade your version of PHP:
1. Make Sure WordPress Is Up-To-Date
As noted above, problems with PHP updates usually arise from older code that is no longer compatible with the new PHP version The best solution to this problem is to run an up-to-date version of WordPress.
WordPress and its wide community of user-developers are keenly aware of PHP’s foundational role and often align their work (from core updates to plugins to themes) to make sure it’s compatible with new versions of PHP. For that reason alone, running an up-to-date version of WordPress is a great way to ensure your site is ready for an up-to-date version of PHP.
2. Check for Compatibility Issues With a Plugin
Even with an up-to-date version of WordPress, however, there’s no guarantee everything will switch over smoothly. Thankfully, you can use plugins to test for incompatibility issues beforehand.
WP Engine’s PHP Compatibility Checker plugin was made for just this purpose. The plugin checks all of the code on your site and flags possible issues—and it can be used on any WordPress site.
To use the plugin, you’ll need to install it on your site, and once it’s active, there will be a new menu item under Tools called PHP Compatibility. Here, simply choose the PHP version you want to upgrade to and then select the plugins and other extensions it will scan across your site.
With that, you can start the scan. Once it’s done, you’ll be presented with a list of errors and warnings for your site. It will even tell you the file name and line number where the issue was encountered.
With that information, you can replace faulty plugins or themes or find a different, up-to-date solution. The PHP Compatibility Checker will also make suggestions.
WP Engine customers can also use the PHP Test Driver, which will allow them to view their website(s) on a different version of PHP before they commit to an update. Similar to PHP Compatibility Checker, the PHP Test Driver provides an excellent line of sight into any potential issues that might arise when updating to a new version of PHP.
3. Upgrade Your Version of PHP
Once you’ve done your due diligence and checked your site for compatibility issues, it’s time to update to your new version of PHP. There are several ways you can do this. For the more technically savvy, one option is updating PHP using SSH commands.
However, a far easier way to update your PHP is through a qualified hosting provider. WP Engine customers are able to view their current PHP version and update it through the PHP Selector tool—just log in to the user portal and follow the steps provided here. If you have any questions, you can contact support at any time.
4. Check Your Site
Once you’ve upgraded your PHP version, the last thing you’ll want to do is go back to your site’s front-end and take a close look. As time allows, you’ll want to check each and every page to make sure everything looks the way it should and that parts of your site aren’t disabled or experiencing other issues.
You’ll also want to check various functions specific to your type of site. For example, eCommerce sites might run a test purchase after updating PHP, or a news site might click through on ads and related articles to make sure everything was updated correctly.
It’s also important to test the plugins you’re using as well as theme features. That said, if you’ve followed the compatibility checks detailed above, it’s unlikely that you will experience a problem. If no issues are apparent, your PHP update is now complete!
PHP is a key element of WordPress and as such, it’s one of the most critical parts of your site.
Not only will running updated PHP benefit your site speed and performance, it will reduce vulnerabilities and improve the overall security of your site, keeping your data safe.
While understanding the way PHP works and knowing what version of PHP your sites are running are both important elements, making sure you update PHP safely is perhaps the most important part.
While some hosting providers leave server-side configurations (including PHP) up to you, WP Engine’s customers are always up-to-date and ready to benefit from WordPress’ latest incredible features, PHP included!
Switch to WP Engine for the performance and security benefits of always up-to-date PHP. Migrate risk-free with a 60-day money-back guarantee and experience the advantage of managed WordPress hosting, perfected.