How to 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 Bluehost and SiteGround hosting accounts.

Update PHP Version in WordPress Site

  1. PHP and WordPress
  2. Version history and support PHP version
  3. Which version to use in WordPress?
  4. Check PHP version of your WordPress site
  5. Steps before updating PHP version
  6. Update compatible PHP version in Bluehost
  7. Benefits of using latest version

Let us discuss the topics in detail.

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 does WordPress work 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
How Does WordPress Work

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.

2. PHP Version History

PHP version 7.0 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 VersionRelease DateEnd of SupportLast Release
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 20165.6.25
7.03 Dec 20153 Dec 20177.0.11
7.11 Dec 20161 Dec 20187.1.14
7.23 Nov 201730 Nov 20197.2.31
7.36 Dec 20186 Dec 20207.3.19
7.428 Nov 201928 Nov 20217.4.7

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.

3. 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.6 or greater OR MariaDB version 10.1 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.

4. How to Check PHP Version?

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 loose the revenue.

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

  • The simplest way is to ask you 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 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

5. 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.

5.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.

5.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.

5.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.

6. 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.

6.1. Update PHP Version in Bluehost

  • Login to your Bluehost hosting account.
  • Go to “Advanced” section.
  • This will take you to the cPanel.
  • 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: Bluehost 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.

6.2. Update PHP Version in SiteGround

  • 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 individual sites 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
  • You can see 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.
  • 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.

You can also install SG Optimizer plugin to change the PHP version with SiteGround. After activating the plugin, go to “SG Optimizer > Environment Optimization > Set Your PHP Version” section and update. The problem with this option is that you will only see the versions in two digits like 7.3 instead of 7.3.18.

6.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.

6.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 xxx version. But i could not see 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.

6.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.

7. 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.

Editorial Staff at WebNots are team members who love to build websites and share the learning with webmasters community. Follow us on Facebook and Twitter.

Leave a Comment