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
- PHP and WordPress
- Version history and support PHP version
- Which version to use in WordPress?
- Check PHP version of your WordPress site
- Steps before updating PHP version
- Update compatible PHP version in Bluehost
- 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.
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 Version | Release Date | End of Support | Last Release |
---|---|---|---|
3.0 | 06 Jun 1998 | 20 Oct 2000 | 3.0.x |
4.0 | 22 May 2000 | 23 Jun 2001 | 4.0.6 |
4.1 | 10 Dec 2001 | 12 Mar 2002 | 4.1.2 |
4.2 | 22 Apr 2002 | 6 Sep 2002 | 4.2.3 |
4.3 | 27 Dec 2002 | 31 Mar 2005 | 4.3.11 |
4.4 | 11 Jul 2005 | 7 Aug 2008 | 4.4.9 |
5.0 | 13 Jul 2004 | 5 Sep 2005 | 5.0.5 |
5.1 | 24 Nov 2005 | 24 Aug 2006 | 5.1.6 |
5.2 | 2 Nov 2006 | 6 Jan 2011 | 5.2.17 |
5.3 | 30 Jun 2009 | 14 Aug 2014 | 5.3.29 |
5.4 | 1 Mar 2012 | 3 Sep 2015 | 5.4.45 |
5.5 | 20 Jun 2013 | 21 Jul 2016 | 5.5.38 |
5.6 | 28 Aug 2014 | 31 Dec 2016 | 5.6.25 |
7.0 | 3 Dec 2015 | 3 Dec 2017 | 7.0.11 |
7.1 | 1 Dec 2016 | 1 Dec 2018 | 7.1.14 |
7.2 | 3 Nov 2017 | 30 Nov 2019 | 7.2.31 |
7.3 | 6 Dec 2018 | 6 Dec 2020 | 7.3.19 |
7.4 | 28 Nov 2019 | 28 Nov 2021 | 7.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:
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.
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.
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 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.
- 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.
- 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.
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.
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.
Leave a Reply
Your email is safe with us.