Table of Contents
Last update on
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:
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:
💡 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:
- Use the Site Health Tool From Your WordPress Dashboard.
- Using Your Hosting cPanel.
- 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.
2. Using Your Hosting cPanel
Another way to check your current PHP version is to use cPanel and follow the instructions below:
- Log into your cPanel account
- Go to the Software tab GENERAL INFORMATION and click on Select PHP Version:
3. At the top of the PHP Selector page, you will be able to see which PHP version you’re currently running:
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:
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.
- Generate a PHP info file (e.g., systeminfo.php) in the following directory: /home/customer/www/yoursite.com/public_html
- Insert the following code into the file:
<?php phpinfo(); ?>
- 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:
- Create a backup of your website
- Update your theme and plugins
- Contact theme and plugins and ask if there’s any known issues
- Monitor errors
- Check the current WordPress compatibility status
- 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.
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.
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.
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.
- Open the dropdown menu near your current PHP version.
- From the list, select the new PHP version you want to upgrade to:
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:
- A drop-down menu appears where you can select the PHP version you want to upgrade to:
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:
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.