How to Update PHP in WordPress Safely: Understanding Compatibility + Upgrading Tips
Hypertext Preprocessor (PHP) is an open-source scripting language used for advanced customization and ensuring optimal performance of WordPress websites.
The WordPress software, themes, and plugins are based on PHP. It is also the language used by WordPress sites to connect and interact with their databases.
Having the latest version of PHP on your site is a great way to improve its security and performance as well as ensure compatibility with your WordPress theme and plugin.
However, performing this task includes several processes, from checking your current version of PHP to finally updating it.
Fortunately, Hostinger offers a PHP configuration tool to help you safely upgrade your WordPress site’s PHP version.
This tutorial will cover all the steps on how to update PHP in WordPress. You will also learn why using the latest PHP version is important and several best practices.
Download WordPress security checklist
Why Update PHP Version in WordPress
Like WordPress themes and plugins, PHP frequently receives updates and patches. Using an older version of PHP may lead to performance issues and make your WordPress site vulnerable to cyber threats.
So, updating to the latest PHP version brings several benefits to your WordPress website, including:
- Performance boost. PHP becomes more efficient with each update, which can significantly improve the site load speed. This way, your WordPress website will be more responsive and provide a better user experience.
- Enhanced security. Cyber criminals often attempt attacks by exploiting PHP vulnerabilities. Updating to newer PHP versions makes your site less vulnerable to security risks.
- Latest features. Upgrading PHP in WordPress will give you access to bug fixes and new features. For instance, PHP 8.2 includes a sensitive parameter attribute, type-system improvements, and supports constants in traits.
- Better compatibility. Updating the website’s PHP version will ensure it is compatible with WordPress plugins and themes optimized for it.
Pro Tip
As WordPress is based on PHP, you can insert custom PHP code to enhance your website’s functionality.
PHP Version Compatibility for WordPress
While WordPress supports multiple PHP versions, we highly recommend using the latest version of PHP to ensure your website remains secure and up-to-date. However, note that not all WordPress versions are compatible with newer PHP releases.
Use the following chart to check whether your WordPress site supports the latest PHP version:
WordPress Version | Supported PHP Versions |
5.0, 5.1 | PHP 5.2, PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, PHP 7.0, PHP 7.1, PHP 7.2, PHP 7.3 |
5.2 | PHP 5.6, PHP 7.0, PHP 7.1, PHP 7.2, PHP 7.3 |
5.3, 5.4, 5.5 | PHP 5.6, PHP 7.0, PHP 7.1, PHP 7.2, PHP 7.3, PHP 7.4 |
5.6, 5.7, 5.8 | PHP 5.6, PHP 7.0, PHP 7.1, PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0* |
5.9, 6.0 | PHP 5.6, PHP 7.0, PHP 7.1, PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0*, PHP 8.1* |
6.1, 6.2 | PHP 5.6, PHP 7.0, PHP 7.1, PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0*, PHP 8.1*, PHP 8.2* |
6.3 | PHP 7.0, PHP 7.1, PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0*, PHP 8.1*, PHP 8.2* |
6.4 | PHP 7.0, PHP 7.1, PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0*, PHP 8.1*, PHP 8.2*, PHP 8.3* |
Note that the (*) symbol indicates the version of PHP is in the beta support phase or compatible but with exceptions, meaning you may encounter minor issues. Also, some themes and plugins may not support these PHP versions yet.
How to Update PHP in WordPress
Updating the PHP version in WordPress only takes several steps. However, you must be careful, as updating to an unsupported PHP version can break your WordPress website.
In this section, we will show you the safest ways to update PHP.
1. Check the Current WordPress PHP Version
To decide whether you should perform an update, check the site’s current PHP version via the WordPress dashboard or your hosting account.
Via hPanel
- On the hPanel dashboard, go to WordPress → Overview.
- Locate the PHP Version section to view your current PHP settings.
If your PHP version is incompatible with your WordPress installation, a notification will prompt you to switch to a compatible version. Simply click the Change button to initiate the PHP version update.
![](https://www.hostinger.com/tutorials/wp-content/uploads/sites/2/2024/06/New-WP_in-text-banner-1024x300.png)
Via the WordPress Dashboard
- On the WordPress admin area, navigate to Tools → Site Health.
- Go to the Info tab and expand the Server category to see the website’s current PHP version.
2. Create a Backup of Your WordPress Site
Before performing a PHP update, we highly recommend backing up your WordPress site. If you encounter unexpected errors after the PHP updating process, you will be able to restore the site.
Hostinger users can back up their WordPress site files and database via their hosting account:
- On hPanel, go to Files → Backups.
- Choose the Generate new backup option → Select.
- A pop-up window will appear, asking for confirmation. Click Proceed to start the backup.
- Wait until the backup process is complete. It may take a while if your website has large amounts of data.
Another option is to create a backup by using a plugin like UpdraftPlus WordPress Backup Plugin. Here is how:
- Install and activate the UpdraftPlus plugin.
- Go to Settings → UpdraftPlus Backups.
- Click the Backup Now button.
- Select the database and website files options on the pop-up window. Then, click the Backup Now button to confirm the action.
![UpdfraftPlus - Perform a backup pop-up window](/tutorials/wp-content/uploads/sites/2/2023/04/updfraftplus-backup-1024x570.png)
- The backup process might take a while, depending on the size of your WordPress website files and database.
3. Update the WordPress Core, Themes, and Plugins
Another important step before updating your WordPress PHP version is checking if there are any updates for plugins, themes, and the WordPress core software available. Doing so will help reduce any compatibility issues when you update your PHP version.
There are two easy methods to choose from – via hPanel and the WordPress admin page.
Via hPanel
It is possible to update the WordPress files, themes, and plugins directly from hPanel. Here are the steps:
- Go to WordPress → Security. You will find information about the WordPress version, plugins, themes, security issues, and recommended actions.
- If any new updates are available, click the Update button to install them.
Via the WordPress Dashboard
Another way to check for software, theme, and plugin updates is via the WordPress admin dashboard:
- Go to Dashboard → Updates. The Updates screen will inform you if there are any updates available.
- To update the plugins, tick the Select All checkbox and click Update Plugins. The steps will be similar when updating WordPress themes.
- Click the Update to version button to update WordPress.
4. Update the PHP Version of Your WordPress Site
Once you have created a backup and checked for WordPress updates, you can proceed to upgrade the PHP version. Remember to check its compatibility with your current WordPress version.
The safest and easiest way to change the PHP version is via your hosting control panel:
- On hPanel, navigate to Advanced → PHP Configuration.
- Select the preferred PHP version and click Update.
- Click Confirm.
- Wait until the update process is complete.
Best Practices for Updating PHP in WordPress:
If this is your first time updating PHP versions in WordPress, we recommend implementing the following practices:
Check PHP Compatibility With Your Theme and Plugins
Some themes or plugins may not support the latest version of PHP or specific older versions. It is important to check the theme and plugin compatibility to ensure that your website will remain functional after the update.
To check the PHP versions supported by your plugins, go to the Installed Plugins page and click View details next to each plugin installed. A pop-up window will display the recommended PHP settings in the Requires PHP Version section.
As for checking a theme’s PHP version compatibility, visit the WordPress theme directory. Find your WordPress theme using the search bar and click More Info. You will find the requirements in the PHP Version section.
Test the PHP Update on a Staging Site
If you check PHP compatibility, there is little to no chance you will face issues. However, it is better to test the new PHP version via a WordPress staging environment to ensure the website will work and function properly.
A WordPress staging environment lets you check and modify themes, plugins, and new PHP versions without affecting the live site.
If you don’t find any problems during the testing phase, you can safely update the PHP version of the live site.
Monitor Your Site for Issues
After you update your PHP version, we highly recommend monitoring your website. Check for broken links, error page redirections, conflicting plugins, and site performance issues.
An easy way to monitor your website is by using a WordPress analytics plugin such as MonsterInsights and WP Statistics. These plugins have powerful tools and features to help you gather, analyze, and track traffic, page views, and site speed.
However, to troubleshoot any possible errors, consider checking the PHP error log. To do that, you need to enable PHP error logging via your hosting control panel.
Once the error is fixed, we recommend disabling the PHP error log so it will not take up too much storage space.
If you still encounter issues after analyzing the site performance and monitoring the PHP error log, revert the site to its older PHP version. The steps are similar to updating PHP – you only need to select the previous version.
Contact Your Hosting Provider Customer Support
Another safe way to update your PHP version in WordPress is to contact the hosting provider’s customer support before doing it. This can be especially helpful for those completely new to this task.
Hostinger’s 24/7 Customer Success team is always ready to provide assistance. Don’t hesitate to contact us if you need help checking PHP compatibility or updating it to the latest version.
You can easily contact us by clicking the Help button from your web hosting account. The Hostinger Help page will display topics related to WordPress hosting and site management. It is also possible to quickly find answers to your questions by describing the issues in the search box.
Conclusion
PHP is WordPress’s core language, so it is also used by themes and plugins. Updating the WordPress PHP version gives your website many benefits, such as boosting its website performance and enhancing site security.
In this article, you have learned how to change the PHP version in WordPress. Here is a recap of the steps:
- Check the current PHP version using the Site Health tool.
- Create a WordPress site backup via hPanel or using a plugin.
- Update the WordPress software, themes, and plugins.
- Update the PHP version of the WordPress website.
We have also covered the best practices for performing a PHP version update for WordPress, such as testing the new version of PHP on a staging site, monitoring the website for issues, and checking theme and plugin compatibility.
We hope we have helped you understand how to update PHP for WordPress. If you have questions, leave a comment below.
Comments
May 17 2024
Does hpanel support php 8.3 as of now?
May 22 2024
Hello! Yes, as of now, hPanel supports PHP 8.3.