Updating PHP is a proactive step that helps ensure your WordPress website remains secure, functional, and aligned with industry standards and best practices. In this article, we’ll explore why it’s imperative to keep your PHP version current. We’ll examine the benefits that come with embracing the latest PHP advancements and guide you through the process of checking your PHP version and safely upgrading it.
At the time of writing this article, the stable version available for PHP is 8.2.10, while WordPress requires at least PHP version 7.4 or greater. Support for version 7.3 officially ended on December 6, 2021, and no further updates will be provided by the PHP team.
Why Should You Update PHP?
We cannot stress enough how beneficial it is to update PHP to the latest stable version. An outdated PHP version can significantly affect a website’s functionality and security on multiple levels.
Let’s see how updating your PHP improves not only the website itself, but everything that surrounds its well-being.
Security and Performance
As PHP evolves, its developers actively patch security issues and release updates.
Running an outdated PHP version exposes your website to potential security risks and hacking attempts. Hackers actively target websites running on old PHP versions because they can take advantage of well-known and well-documented vulnerabilities.
Also, when a vulnerability is discovered in an outdated PHP version, it may not receive security patches or updates from the PHP development community immediately, or at all, if it’s End of Life (EOL). This has the potential to result in unauthorized access, data breaches, defacement, and various other security violations.
Furthermore, PHP updates serve a dual purpose, as they not only tackle security concerns but also rectify related bugs and glitches. These bug fixes can contribute to enhancing the overall stability and reliability of your website.
Another thing is that newer PHP versions often come with performance improvements and optimizations. Upgrading has the potential to enhance website loading speed and overall performance, thereby enhancing the user experience.
Feature Enhancements and WordPress Compatibility
Newer versions also introduce useful features, improved syntax, and other capabilities. Not updating to the latest version can make it harder to create and maintain a modern, feature-packed website.
Keeping PHP up-to-date ensures that your website remains compatible with the latest themes, plugins, and libraries available for WordPress.
WordPress themes and plugins utilize newer PHP features to improve their performance or add new capabilities. When you update your PHP version, you ensure that these plugins and themes function correctly. If your PHP version is outdated, you may encounter compatibility issues, such as features not working as intended or even errors and crashes.
Debugging issues with an outdated PHP version can indeed present greater challenges. Modern developers often depend on the latest tools and error-reporting features to diagnose and resolve issues efficiently.
Current PHP versions come with better tools for finding and fixing issues in your code, making it simpler to spot and solve problems in your website’s programming. Staying current with PHP ensures that you have access to the best resources for effective debugging, ultimately saving time and streamlining the troubleshooting process.
Depending on your website’s purpose and your location, using outdated software may put you at odds with legal and regulatory requirements.
Many countries and regions have strict data protection regulations (e.g., GDPR in Europe, CCPA in California) that require organizations to maintain the security of personal data. Using an outdated PHP version can put your compliance with these regulations at risk.
Staying up-to-date can help you comply with relevant laws and industry standards and avoid compliance issues and legal consequences.
Hosting Provider Support
Hosting providers commonly update their PHP versions and stop supporting older versions because they need to ensure their server stability. That forces you in a way to update PHP on your website as well, if you want to continue using their services.
Otherwise, your website could become inaccessible.
Maintaining an older PHP version can become increasingly challenging as time goes on. Developers and the PHP community primarily focus on supporting the latest versions. Using outdated PHP can lead to difficulties in finding support and resources for your website.
How to Check Which PHP Version My WordPress Site Uses?
There are several methods you can use to check which PHP version you are using. Here are a few common ways:
Check Your Hosting Control Panel
If you use a hosting provider that offers a control panel (e.g., cPanel, Plesk), check their documentation to see where you can find information about your PHP version.
In Plesk for example, you can expand your website’s tab and see the PHP version right in the Dashboard -> Dev Tools
Once you’ve determined the PHP version you’re using, it’s a good idea to ensure that it meets the minimum requirements for your website and consider upgrading for security and performance reasons.
Use the PHP Function
If you have FTP access to your website’s files, create a new PHP file in a directory you can access and add the following code to the file:
<?php phpinfo(); ?>
Save the file and access it through a web browser. If, for example, the file is in your root directory you should visit http://YOURDOMAIN.com/FILENAME.php.
There, you will see a page with detailed information about your PHP configuration, including the PHP version at the top.
Use the Display PHP Version WordPress plug-in
If you can access the WordPress admin area, you can install a plugin like “Display PHP Version” to get information about your PHP version.
After you install and activate the Display PHP Version plugin, you can go to your WordPress admin page and look next to your WordPress version to see what PHP version is running at a glance.
Contacting Your Hosting Provider
If you’re unsure about performing any of the above, you’d better contact your hosting provider’s support. They should be able to provide you with information about the PHP version you are using.
In a Managed WordPress Hosting service like Pressidium, there is always a customer portal that can give you this information at your fingertips.
In the Pressidium Dashboard, the PHP version is displayed under the Overview tab of any website you are managing.
Now let’s take a close look at the process of updating your PHP version.
Try our Award-Winning WordPress Hosting today!
How to Upgrade PHP in WordPress
There are some steps you need to follow before you start upgrading in order to make the process as smooth as possible.
Preparing for PHP Upgrade
Now that you’ve checked what PHP version your website uses, you are ready to resume the rest of your preparation to upgrade.
Before upgrading PHP, make sure that your WordPress version, themes, plugins, and custom code are compatible with the new PHP version you plan to install.
Visit your theme’s website. Theme developers usually mention PHP compatibility in their theme documentation or release notes.
Visit each plugin’s website or repository as well. Look for information regarding PHP compatibility in the plugin’s documentation or the download page.
Check if your current WordPress core version is compatible with the PHP version you plan to upgrade to. WordPress often provides information about PHP compatibility in its release notes.
Create a full backup of your WordPress website, including the database and files. You can use a backup plugin or your hosting provider’s backup tools for this purpose. This ensures that you can restore your website in case something goes wrong during the upgrade.
If possible, set up a staging environment that mirrors your live website. This allows you to test the PHP upgrade without affecting your live site. You can do this on a subdomain or a separate directory on your hosting server.
Draft a list of URLs/pages or use cases you can review/check after upgrading to verify that function as intended. This might be adding products to a cart, signing up for a course, carrying out common administrative work in the WordPress admin interface, or visiting popular pages based on traffic/user engagement.
Pro Tip: If you upgrade across several PHP versions, you might consider performing PHP version upgrades in sequence i.e. upgrade from PHP 5.6 to PHP 7.0, then to PHP 7.1, then to PHP 7.2 etc. This will help you isolate and pinpoint any specific issues with each version.
Another good idea is to review the official PHP migration guides and remember to check backward compatibility before upgrading:
- Migrating from PHP 5.6.x to PHP 7.0.x (https://www.php.net/manual/en/migration70.php)
- Migrating from PHP 7.0.x to PHP 7.1.x
- Migrating from PHP 7.1.x to PHP 7.2.x
- Migrating from PHP 7.2.x to PHP 7.3.x
- Migrating from PHP 7.3.x to PHP 7.4.x
- Migrating from PHP 7.4.x to PHP 8.0.x
- Migrating from PHP 8.0.x to PHP 8.1.x
- Migrating from PHP 8.1.x to PHP 8.2.x
- PHP: Backward incompatible changes – Manual
- Update WordPress core, Themes, and Plugins. Ensure that you are running the latest version. If they are outdated, they may not be compatible with newer PHP versions.
- Upgrade PHP to the new PHP version.
- Thoroughly test your website in the staging environment. Check for any errors, broken functionality, or compatibility issues. Despite the check you have already done beforehand, there are still chances that custom functionality or plugins might be affected by the PHP upgrade. If you have custom PHP code in your theme or plugins, review and update it if necessary to ensure compatibility with the new PHP version.
- Monitor the error logs in the staging environment. Any PHP errors or warnings or deprecation notices that occur during testing should be addressed and resolved. You might need to temporarily enable WordPress debug mode to increase the verbosity and the information contained in the logs.
Now go to the production environment to resume.
NOTE: You should pick a time when your website experiences the least traffic to minimize disruptions. Ideally, inform your users in advance about the planned downtime.
Remember to make a full backup first! and then Upgrade PHP on your live site with the same procedure you followed on your staging site. As mentioned earlier, you may need to contact your hosting provider or server administrator for help during this process.
- Monitor after the upgrade for any issues that may have been missed during staging testing.
- Keep an eye on your website for a period after the upgrade. Sometimes, certain issues may not become apparent immediately.
Upgrading PHP as a Pressidium Customer
For your pre-upgrade phase, you can make your checks and tests in a staging environment that you can create in minutes with one click.
There, you can resolve potential compatibility issues before switching PHP version on your production site. If you need to also enable WordPress debug mode, you can do this easily in the dashboard as well.
Updating your PHP version is not just a matter of best practice; it’s a critical step in safeguarding the functionality, security, and overall health of your website. Running an outdated PHP version exposes your website to vulnerabilities that hackers actively exploit, potentially leading to data breaches, unauthorized access, and other security breaches.
Hopefully, by reading this guide, you will be able to safely and correctly upgrade your PHP and enjoy a modern and fully functional website.