Home » Web Tutorials » WordPress » How to Check and Update PHP Version in WordPress Site?

How to Check and Update PHP Version in WordPress Site?

PHP is an open source scripting language that acts as a backbone of your WordPress site. As with every software languages, PHP is also maintained and updated continuously to have improved functionalities and better security. Hence, it is important to use the correct and latest PHP version for your WordPress site to have better security. In this article, we will discuss how to update PHP version in WordPress using various methods including from standard cPanel and custom hosting accounts like SiteGround.

1. PHP and WordPress

WordPress is an easy to use content management system in the frontend, but it is very complex at the backend. You can read our separate article on how WordPress works to understand the model in detail. In summary, when a WordPress site loads on browser it needs to interact with theme files, plugin files, core files and MySQL database as shown below.

How Does WordPress Work
Way WordPress Works

All WordPress files are written in a server side scripting language, that is PHP. It helps to interact with different files and with MySQL database to extract the requested content from the hosting server. So, using updated and supported version of PHP is very important for your WordPress site to work properly.

1.1. PHP Version History

PHP version 8.3 is the currently supported version. We recommend you to update, if you are using anything lower than 7.0. Below table shows the PHP version history along with the expiry of the active support. You can view the timeline and status of new releases in the official PHP site.

PHP VersionInitial Release DateLast Release DateLast Released Version
3.006 Jun 199820 Oct 20003.0.x
4.022 May 200023 Jun 20014.0.6
4.110 Dec 200112 Mar 20024.1.2
4.222 Apr 20026 Sep 20024.2.3
4.327 Dec 200231 Mar 20054.3.11
4.411 Jul 20057 Aug 20084.4.9
5.013 Jul 20045 Sep 20055.0.5
5.124 Nov 200524 Aug 20065.1.6
5.22 Nov 20066 Jan 20115.2.17
5.330 Jun 200914 Aug 20145.3.29
5.41 Mar 20123 Sep 20155.4.45
5.520 Jun 201321 Jul 20165.5.38
5.628 Aug 201431 Dec 20185.6.40
7.03 Dec 201510 Jan 20197.0.33
7.11 Dec 20161 Dec 20197.1.33
7.23 Nov 201730 Nov 20207.2.34
7.36 Dec 20186 Dec 20217.3.33
7.428 Nov 201928 Nov 20227.4.33
8.026 Nov 202026 Nov 20238.0.30
8.125 Nov 202121 Dec 20238.1.27
8.28 Dec 202218 Jan 20248.2.15
8.323 Nov 202318 Jan 20248.3.2

The security updates will be provided around one year addition after the expiry of active support. After that the PHP version will reach the end of life. But you don’t need to wait till the end of life for upgrading.

1.2. Which PHP Version to Use?

At that time we write this article, the current WordPress versions 5.4.2 needs the following requirement for protecting your site from vulnerabilities.

  • PHP version 7.4 or greater
  • MySQL version 5.7 or greater OR MariaDB version 10.4 or greater
  • HTTPS support

This is an official recommendation for running a WordPress site. This will be changing dynamically when the life cycle of the PHP version ends in future. So, you should monitor the requirement from WordPress.org requirements page and update to the latest version actively.

2. How to Check PHP Version in WordPress?

You may not even notice the PHP version, when things are going fine. But some plugins need certain version of PHP to work as intended. Let us take an popular WooCommerce plugin as an example. You need to have PHP version 5.6 or later in order to use the latest WooCommerce version. Otherwise, your online shop may not work and you may lose the revenue.

There are many ways to find the PHP version of your WordPress site:

  • The simplest way is to ask your host.
  • Use plugin like Display PHP Version to see the version number in your dashboard under “At a Glance” section.
  • Use php.ini or phpinfo.php file to view the PHP version.
  • Check your cPanel under the statistics sidebar or use apps like “PHP Config”, “PHP Variable Manager” or similar. Remember that each folder on your account can have different PHP versions. Hence, look for the folder on which you have WordPress installation.
  • Most of the commercial themes and some of the plugins will have the option to check the server status like PHP version, memory limit, etc. For example, if you are using WooCommerce, you can view the PHP version under “WooCommerce > System Status” menu as shown below:
View PHP Version with Woocommerce
View PHP Version with Woocommerce

Latest WordPress versions include a feature called Site Health. It will show a warning message in the Dashboard section when you use deprecated PHP like below.

PHP Update Required Warning
PHP Update Required Warning

You can go to “Tools > Site Health > Info” section to find the latest PHP version used on your site. You will see a warning message under “Status” tab when using deprecated version.

Check PHP Version in WordPress Site Health
Check PHP Version in WordPress Site Health

3. Steps Needed Before Upgrading PHP Version

Unfortunately updating PHP version is not an easy task, especially for larger WordPress sites. Because the official recommendation will only take care of the updated core WordPress files. As explained above you need to ensure the compatibility of your theme and plugins before upgrading PHP version.

That is one aspect, the other important aspect is the support needed from your hosting server. Always checks the recommended PHP version whenever new WordPress version is released and check with your hosting company whether they support the latest requirements. Most of the popular hosting companies will definitely will support while there are many other companies may not. In such a case, you probably need to look for a decent hosting company to migrate your WordPress site completely.

We highly recommend to do the following steps before upgrading to PHP version to avoid potential lose of data and exposing the vulnerabilities to hackers on a live site.

3.1. Take a Backup

That’s always the lesson one in updating any of the WordPress components like PHP, database, theme, plugins or core version. You can do manual backup or use plugins to do the backup for you. Also most of the hosting companies offer files and database backup based on your hosting plan. So ensure to have a backup of your files, at least the database file, before doing any upgrade activity.

3.2. Create a Local Copy

Once you have a backup of your WordPress site then create a local copy. You can learn how to create localhost using MAMP from your live site. On the local copy you can update the PHP version and test all the features are working properly.

If there are issues you will either see a white screen of death or PHP errors instead of the content. Remember, you will only see PHP errors and not the warning messages. Generally warning messages are not shown explicitly. In order to check the warning messages, add the below line in your wp-config.php file and enable debugging on your local copy.

define( 'WP_DEBUG', true );

This will help you check the incompatibility warning from theme and plugins so that you can discuss with the developer proactively. Once you complete the testing remove the above line to disable debugging.

3.3. Create a Staging Site

This option is available only if your hosting plan allows you to create staging site on the server. If yes then instead of doing long testing with local copy as explained above, you can do near live testing by creating a staging copy of your live site.

4. How to Update PHP Version in WordPress?

Finally, if everything works fine you can go for the next step of upgrading PHP version on live site. The process differs depending on your hosting company. Here we will explain with the two popular hosting companies – Bluehost and SiteGround.

4.1. Update PHP Version in cPanel

  • Login to your cPanel hosting account (like HostGator or Bluehost).
  • Search and open cPanel section.
  • Search for “MultiPHP Manager” app under “Software” section and open it.
MultiPHP Manager in Bluehost
MultiPHP Manager in Bluehost
  • MultiPHP Manager app will show you the PHP versions of all the sites under your hosting account.
  • Select the site you want to change the PHP version.
Change PHP Version
Change PHP Version
  • Choose the PHP version from the dropdown and click on “Apply” button.
  • You should see a success message after changing the version.

Note: cPanel has an option to inherit PHP version. You can check this article on how inheritance will impact on the domain and subdomain on your hosting accounts based on .htaccess file.

4.2. Update PHP Version in SiteGround Custom Panel

  • Login to your SiteGround hosting account and go to “Websites” tab. SiteGround has migrated from cPanel to Site Tools, hence you have to update PHP version for each site separately.
  • Click on the “Site Tools” button against the site you want to change the PHP version.
  • Look for “PHP Manager” app under “Devs” section.
PHPManager in SiteGround
PHPManager in SiteGround
  • Check the current PHP version of your site and click on the pencil icon.
  • You can choose the “Managed PHP” option if you want SiteGround to update your version automatically. We do not recommend this as it can break your site without your knowledge. So, choose “Change PHP Version Manually” option.
  • Choose your version from the dropdown and click “Confirm” button to apply the changes.
Confirm PHP Version Change in SiteGround
Confirm PHP Version Change in SiteGround

Select the official recommended version by WordPress and save your changes. That’s it!!! Now you have changed the PHP version of your WordPress site, use one of the above explained methods to verify the PHP version. Also ensure to check all the functionalities of your site are working after the upgrade.

Earlier, there was an option with SiteGround Speed Optimizer plugin to change the PHP version under “SG Optimizer > Environment Optimization > Set Your PHP Version”. However, this was removed as the plugin is now available for all users.

4.3. Using Different PHP Versions for Different Sites

You can change the PHP version for each folder on your account. The folder can be different sites, directory or subdirectory. When you update the version of the high level folder it will be applied on all the subfolders automatically. So, if you have multiple sites running with different platforms then choose the correct root directory on which your WordPress site is installed. Also, remember to select the correct directory when multiple WordPress sites are installed on the same server. If there is an option, choose “public_html” option for changing the version at account level.

If your host supports, you can manage PHP version of each folder by adding a directive in .htaccess file. For example, add the following line at the start of .htaccess file in the folder which you want to force PHP 7.4. In this case, other folder in your hosting account can use different PHP version like 8.3.

AddHandler application/x-httpd-php74 .php .php5 .php4 .php3

4.4. Contacting Your Host

If you don’t see the recommended PHP version is listed, then immediately contact your hosting company to inform them about the problem. You can send them the below details in an email or chat or support ticket. Remember to modify the folder and version as per your need.

Content for Requesting PHP Version Update from Your Host

Hi,

I would like to update the PHP version of my WordPress site to version 8.2. But I could not find the option is available in cPanel. So, I wonder whether you support the recommended version as mentioned in the formal WordPress requirements page - https://wordpress.org/about/requirements/.

Please let me know how can I update to the required PHP version?

Thanks!

Your Name

If your host confirms that they should update the version manually at backend then provide them the folder and PHP version details. In such a case, confirm with them when they should update the server and allow you to do it directly from cPanel. If you don’t get a proper response then it’s time for you to look for a new host since you may need to update the PHP version frequently.

4.5. Contacting Theme and Plugin Developer

You can use similar request like above to contact theme and plugin developers if you have compatibility problems. In case if the developer is not planning to update the theme or plugin then you may need to look for alternate option that supports updated PHP version.

5. Why Should You Update PHP?

WordPress core always recommends the latest stable PHP version. There are many good reasons you should plan to update to the latest PHP version.

  • The latest PHP version shall offer very good performance boost to your WordPress site. For example, version 7.x can speedup your site up to 50% compared to the previous stable version 5.6.
  • Improved security over vulnerabilities.
  • Installed plugins and theme may need the latest version for stable operation.

Final Words

It is very easy write how to update PHP version. But in reality, this is a daunting tasks for the larger sites having different plugins and many subdomains. Considering the speed and security, we don’t think the site owners have any other option other than updating PHP version to the latest recommended one. This exercise will also show the activeness of the plugin, theme and hosting company. You can decide to switch based on the experience as PHP update is required frequently.

Leave a Comment

Your email address will not be published. Required fields are marked *