Table of Contents

Do you want to learn how to update the PHP version on WordPress? You are in the right place. Keeping your site up-to-date is imperative for optimal functionality and security. Any website owners must meticulously update their themes, plugins, and the core platform to ensure a seamless and secure user experience. Running an updated PHP version on your WordPress site is also a crucial thing that YOU should not overlook.

This article delves into why upgrading your WordPress PHP version is essential for enhancing performance and fortifying security. We will also guide you through updating PHP in WordPress. 

What is PHP?

PHP – which stands for “Hypertext Preprocessor” – is a programming language that web developers use to create dynamic and interactive websites. It works behind the scenes to process information and interact with databases, making websites more engaging and functional. 

In plain English, PHP brings your website to life. That’s an example below of PHP to create a login page. As you can see below, the PHP code is part of the HTML: 

PHP code example - Source: WP Rocket
PHP code example – Source: WP Rocket

How Does PHP Work on WordPress

PHP is the language for developing WordPress core, plugins, and themes. It provides the essential functionality to present dynamic web pages to visitors. The pages built with PHP are not stored in advance; they are made on the spot when someone asks to see them. 

When you click on a link or type a web address, a special PHP module on the server takes charge. It uses PHP instructions to build a brand-new webpage in HTML format. The server then sends this complete HTML page to your web browser so you can see the website you requested. 

If you prefer a visual representation, here’s a diagram that explains it effectively:

PHP on WordPress explained - Source: WP Rocket
PHP on WordPress explained – Source: WP Rocket
💡 In a WordPress site, PHP’s primary role is to retrieve the page content stored in your WordPress database and transform it into a webpage. 

What Is the Last Stable Version of PHP Available? 

PHP 8.3 is the most recent stable version, representing a significant advancement over its predecessor, PHP 7.

How Would Your WordPress Site Benefit from a PHP Upgrade

The three main benefits of using an updated PHP version on your WordPress site are the following: 

1. Better App Performance

New PHP releases often come with performance optimizations and improved execution functions, allowing your site to offer a better performance. Upgrading to a more recent PHP version improves how functions work in WordPress and enhances the platform’s overall performance. 

Using an outdated PHP version can also impact performance KPIs such as the Time to First Byte (TTFB), which measures the time it takes for a browser to receive the first byte of response after a request has been made on the server. 

Want to offer quicker page loading times, a better TTFB, and a more enjoyable user experience for your visitors? 

📖 Try WP Rocket to easily boost your performance and improve your Core Web Vitals thanks to its powerful features. It takes just a few clicks!

2. Improved Security

Using an updated PHP version is crucial for ensuring the security of your WordPress site. As PHP evolves, it brings new security features, bug fixes, and enhancements to protect against potential vulnerabilities. Running an outdated PHP version may expose your site to security risks. On the contrary, staying up-to-date ensures that your website benefits from the latest security measures and maintains a safe online experience. 

3. Ongoing Support and Compatibility

Choosing an updated PHP version ensures ongoing support and compatibility with the latest technologies and versions of themes and plugins. Developers regularly release updates, patches, and support for the most recent PHP releases. By keeping your PHP code up-to-date, you gain access to the latest features and ensure that your site remains compatible with emerging technologies, plugins, and themes, reducing the risk of compatibility issues. 

How to Check Your Current PHP Version

There are three easy ways to check your current PHP version: 

  1. Use the Site Health Tool From Your WordPress Dashboard.
  2. Using Your Hosting cPanel.
  3. Create and Upload a PHP file to your WordPress Site’s Root Directory.

Let’s go over the three techniques so you will know if you are running an updated version of PHP.

1. Use the Site Health Tool From Your WordPress Dashboard

From the WordPress Admin, go to Tools > Site Health > Scroll down to the Server tab > Check the PHP version line. 

In our demo, we are using the 8.1.22 version, which is okay for the smooth running of our site. 

Identifying my PHP version – Source: The WordPress admin

2. Using Your Hosting cPanel

Another way to check your current PHP version is to use cPanel and follow the instructions below:

  1. Log into your cPanel account 
  2. Go to the Software tab GENERAL INFORMATION  and click on Select PHP Version:
Identifying my PHP version with cPanel – Source: cPanel

3. At the top of the PHP Selector page, you will be able to see which PHP version you’re currently running:

Identifying my PHP version with cPanel - PHP Extensions - Source: cPanel
Identifying my PHP version with cPanel – PHP Extensions – Source: cPanel

Good to know: If your hosting provider is not using “cPanel” per se, like SiteGround, for example, then the information should be under the Devs or any PHP tabs like shown below: 

Upgrading PHP manually from the host admin panel - Source: SiteGround
Upgrading PHP manually from the host admin panel – Source: SiteGround

3. Create and Upload a PHP file to your WordPress Site’s Root Directory.

​To determine the PHP version employed by a specific website, you can use PHP itself. 

  1. Generate a PHP info file (e.g., systeminfo.php) in the following directory: /home/customer/www/yoursite.com/public_html 
  1. Insert the following code into the file:
<?php phpinfo(); ?>
  1. Access the file through a web browser using the following URL:

http://yoursite.com/systeminfo.php 

4. Check the PHP version displayed on the page.

Now that you know how to check the PHP version of your site, it would be interesting to verify that you are ready for an update (and whether you need one). 

Should You Update to PHP8?

The answer is yes, but if you are running an old version of PHP (like 5+), we recommend you update gradually. If you are still determining which PHP version you should update your site, here are a few guidelines that should help you. 

5+ PHP version: UPDATE. Move away regardless of the upgrade cost because this version is the least-performing one. Consider updating gradually to PHP 7, monitoring the issues, and then to PHP 8 if everything goes smoothly. 

7+ PHP version: SAFE ZONE. It’s worth considering moving to 8+ if there are no major conflicts resulting from that. 

8+ PHP version: MONITOR. Check for errors and conflicts and get faulty plugins/themes to fix them.

Having gained insight into verifying your current PHP version, the next consideration is: How do you prepare your website for PHP upgrading? To assist you in this process, we’ve compiled a checklist to guide you through a series of steps to ensure a secure and seamless PHP transition.

How to Prepare Your Website for PHP Upgrading

Preparing your website for PHP upgrading is crucial to ensure a smooth transition and optimal performance. Here’s a list of techniques you can follow to get ready to update PHP:

  1. Create a backup of your website
  2. Update your theme and plugins
  3. Contact theme and plugins and ask if there’s any known issues 
  4. Monitor errors
  5. Check the current WordPress compatibility status
  6. Scan your site with the PHP compatibility checker plugin

This preparation should not be rushed; that’s why we recommend you go through each action listed below thoroughly:

1. Create a Backup of Your Website 

Before upgrading PHP, ensure the safety of your website by creating a comprehensive backup to prevent potential data loss.

2. Update Your Theme and Plugins

Ensure that your theme and plugins are updated with the latest versions, as this contributes to a smoother transition during PHP upgrading.

3. Contact Theme and Plugins and Ask If There’s Any Known Issues 

Reach out to the developers of your theme and plugins to inquire about any potential compatibility issues or specific considerations related to the PHP version you will upgrade to. Don’t forget to visit their blogs, as they might have posted an announcement confirming the PHP compatibility. 

4. Monitor Errors

Closely monitoring errors becomes especially crucial during a major PHP release, as certain functions may be deprecated or potentially buggy. This scrutiny is even more critical when upgrading to a newly released version, where it’s too early to predict potential conflicts or issues that might arise. Pay close attention to error logs and address issues promptly to ensure a smoother transition toward a higher PHP version.

You can use the Error Log Monitor plugin to check if you have any incoming incompatibility errors when using a more up-to-date PHP version.

5. Check The Current WordPress Compatibility Status

Verify the current compatibility status of your WordPress version with the targeted PHP version to ensure seamless integration and avoid compatibility conflicts. The information is updated by the Core developers and is presented as a list. Here’s the link to check the PHP compatibility with WordPress versions

PHP compatibility vs WordPress versions – Source: WordPress.org

6. Scan Your Site With the PHP Compatibility Checker Plugin

The PHP Compatibility Checker plugin assesses and reports the compatibility of a WordPress site’s PHP code with different PHP versions, ensuring optimal performance and security. You can easily scan your site to check if the themes and plugins will work with an updated version of PHP before you upgrade. 

The plugin can help make update decisions and share bugs with themes and plugin authors.  

PHP compatibility checker scanning your site – Source: WordPress.org

In summary, here’s a checklist for you to use in preparing your site for a PHP upgrade. Make sure to save this image so you don’t end up breaking your site. 

Checklist to prepare your site for PHP upgrading - Source: WP Rocket
Checklist to prepare your site for PHP upgrading – Source: WP Rocket


By following this checklist, you can ensure a smooth and successful transition during the PHP upgrade, minimizing potential issues and optimizing the performance of your website. 

How to Update to the Latest Version of PHP

To update to the latest version of PHP, you can go to your cPanel, do it manually on your server, or ask your hosting provider to do it for you. 

Here’s a step-by-step guide on how to update to the latest version of PHP:

1. Upgrading PHP with cPanel

Upgrading PHP through cPanel is a straightforward process. 

  • Log in to your cPanel account.
  • Navigate to the Software section and look for the Select PHP Version option. 
The PHP version button to upgrade PHP - Source: cPanel
The PHP version button to upgrade PHP – Source: cPanel
  • Open the dropdown menu near your current PHP version.
Current PHP version and dropdown – Source: cPanel
  • From the list, select the new PHP version you want to upgrade to:
The dropdown menu to upgrade PHP - Source: cPanel
The dropdown menu to upgrade PHP – Source: cPanel

If your host is not using cPanel, then you need to find the PHP menu and update from there directly. That’s how it works for SiteGround:

  • Go to Devs > PHP Manager > Click on the Change PHP version button:
The “change PHP version” button - Source: SiteGround
The “change PHP version” button – Source: SiteGround
  • A drop-down menu appears where you can select the PHP version you want to upgrade to: 
The drop-down menu to update PHP - Source: SiteGround
The drop-down menu to update PHP – Source: SiteGround

2. Upgrading PHP on Your Server

If you manage your server, upgrading to any version of PHP is a task you can undertake by following the migration guides of php.net. It’s crucial to carefully review new features and functions and any deprecated features that could potentially affect your website. 

Simply select the right migration versions to start the process:

Updating PHP manually - Source: php.net
Updating PHP manually – Source: php.net

3. Asking Your Web Host to Upgrade PHP

If you prefer a hands-off approach, contact your web hosting provider and request a PHP upgrade. Submit a ticket or reach out through their designated communication channels, specifying the PHP version you wish to upgrade to.

Following these steps above, you can safely update to the latest PHP version, ensuring that your website remains secure, performs optimally, and stays in line with the latest industry standards.

How Much Time Does It Take to Upgrade a Website?

The duration needed to update the PHP of a website can greatly vary based on factors such as website complexity and features. Typically, the process should take only a few minutes. If you have asked your host to do it, you should receive a notification when the process is completed.

How Will Your Website Be Affected When PHP Is Updated?

Toward the end of this procedure, the PHP engine will undergo a restart, leading to a brief downtime, affecting only the WordPress backend. If all goes smoothly, your site will remain accessible to visitors during this period. To be on the safe side, it’s essential to plan updates during periods of lower traffic.

What if You Update PHP and Then Have Problems?

Problems arising from PHP version updates occur when the code on your site relies on outdated functions no longer supported by the newer PHP versions. The likely sources of these issues are plugins or an active theme.

Pro tip: always perform a PHP update on a staging site first to avoid any bad surprises.

 If there is an incompatibility, like a plugin or your theme not aligning with the updated PHP version, you might encounter a 500 error or the white screen of death on your site’s front end. In such cases, the most straightforward approach to pinpointing the issue is to disable all third-party plugins and re-enable them one by one.

If you no longer have access to your WordPress admin, restore an older version of your site. Your host should have a copy. 

Wrapping Up

In conclusion, upgrading your PHP is crucial for maintaining a WordPress site that operates seamlessly. Regularly checking WordPress.org for the latest news and updates related to PHP and WordPress ensures that your website remains at the forefront of compatibility and security.

The benefits of upgrading extend beyond just a smooth-running website. Compatibility with the entire WordPress ecosystem is essential, preventing potential conflicts with plugins and ensuring a harmonious integration of features. Security is another pivotal factor, as an outdated version of PHP leaves your site vulnerable to potential threats.

While a PHP upgrade is a fundamental step in enhancing performance, there are additional measures that can be taken for an even greater boost. Implementing image and code optimization, incorporating caching mechanisms, and using GZIP compression are effective techniques to optimize your site’s speed further. For a comprehensive solution, consider pairing the PHP upgrade with a performance plugin like WP Rocket, which can make your site load faster without any effort from your side. WP Rocket is a powerful and easy-to-use performance plugin that allows you to save time and focus on your business. Plus, you don’t take any risks with the 100% money-back guarantee within 14 days of your purchase.


Comments (20)

Dmitry from Russia is here. Rocket license with us!
Thank you for the article.
Now on the server version php 7.0 and 7.3 is available. Can I try to go on it? And whether the latest version of php always means improving the performance of the site.

Can we upgrade straight from 5.4 to 7.2? or do we have to do this upgrade by upgrade?

Thanks for all of the very useful info. I know I updated the PHP files on my website "recently" but since I can't remember when "recently" was - I am going in to do a check. I use Siteground and they are always very helpful sending alerts. Nevertheless - I'll check it out anyhow.

Is there an easy way to upgrade the PHP old code to PHP 7.2?

Thanks! I was being slow on upgrading on my webserver because of compatibility fears.

But after reading this, went ahead and did it since it is easy to revert on my webserver... and I'm amazed!

The site loading speed improvements are very noticeable.

Great to hear that Josh. :)

@Jose simply check with plugin authors and your theme if they support 7.2

We have multisite installation with over 600 sites and over 500 blog owners. Some blogs use old, incompatible themes and plugins. We can't simply turn off the incompatible items -- the uses will storm the castle with torches and pitchforks. And they will demand that we do not upgrade or that we migrate their blogs for them (and make them look and work just the way they did before removing the incompatible themes/plugins).

Do you have recommendations on how to handle such a multisite migraiton?

DS, in your case I would turn to a developer to assist you in this process due to the nature and size of your project. There might be plugins / themes that will need to be retired in this process.

I updated my website from PHP 5.4 to 7.0 and found that my theme is not compatible. It breaks the website. In particular I see various error messages that mysql codes are no longer in use in PHP 7.0. My theme is no longer being developed/maintained by the author. Switching themes is a real pain and plays havoc with many css styles, etc.

Are there any developers who can help with this?

Thanks.

I was looking for an article that would encourage me to upgrade my Wordpress site from 5.6 to 7.2. Thank you Kim for this article.
Its easy to upgrade using cPanel, few clicks away, I have created a sub-domain for the staging version. Now my question is, using cPanel, is there a way to upgrade the PHP version of my sub-domain and retain the old version for the live? Or do i need to test the upgrade on my local computer?

Renz, you will need to ask your hosting company since they all manage PHP versions slightly differently.

Yeah i have no clue why but wordpress is reading my php 7.3 as 5.4. I cant effectively do anything anymore to it. Ive restore my backup of old site and I am just searching for solutions. The hosting tech support staff said they are using a MariaDB in place of MySQL and the PHP version is 7.3. So what do i do?

I have looked everywhere and I am still not sure if Cloudflare is actually compatible with 7.3.
Can you answer this?
"PHP Compatibility Checker" threw up 2 errors and 2 warnings... Thanks!

Hi,
Very informative and thanks for sharing such info details. But you missed 1 thing that if anyone upgrade to newer version of PHP and things go wrong then can we downgrade version to things normal as it were?

Latest Articles of Page speed and caching
Subscribe to Our Newsletter

Stay in the loop with the latest WordPress and web performance updates.
Straight to your inbox every two weeks.

Get a Faster Website
in a Few Clicks

Setup Takes 3 Minutes Flat
Get WP Rocket Now