WordPress 6.4 – Embracing PHP 8.1 for Enhanced Performance and Security

It’s Important to Keep WordPress and its Components Up to Date

Your website’s PHP software may need to be updated. Your website is built with WordPress software. Software is vulnerable and requires regular maintenance. WordPress Core, the plugins you install, and any third-party systems integrated with your website are all pieces of software that need to be maintained, cared for, and updated. It’s that time again. WordPress has just released a new version of its software. You can view the WordPress 6.4 release announcement here.

Minimum Recommended PHP Version Change to 8.1 is Significant

One of the more significant components of this release is the update on the recommended minimum PHP version to use when running WordPress. It’s now recommended to use PHP 8.1 or 8.2 with this release. PHP is a programming language on which the WordPress code is based. This language runs on the server, and it is critical to keep it updated for security and functionality.

It’s important to note that PHP 8.0, the version your website may be running on now, is set to reach end of security support on Nov. 26, 2023 – only a couple weeks away. While this date will not impact the operation of the PHP software, what is does do is to signal the end of security updates for the software. As security vulnerabilities are identified in PHP, updates to correct the problems will be applied to versions 8.1 and higher. A complete listing of the supported versions of PHP may be found on the php.net website.

Stairstep chart showing PHP support end of life.
Each release branch of PHP is fully supported for two years from its initial stable release. During this period, bugs and security issues that have been reported are fixed and are released in regular point releases.

Test Your Websites for PHP 8.1 Compatibility

To ensure your WordPress website is compatible with PHP 8.1, you can follow these steps:

  1. Use the WP Engine PHP Compatibility Checker plugin:
    • The WP Engine PHP Compatibility Checker plugin can be used on any WordPress website, regardless of the hosting provider. It analyzes the theme and plugin code installed on your site and generates a report of compatibility issues based. The report categorizes issues into errors and warnings, providing file and line numbers for problematic code. This plugin does not execute your theme and plugin code, so it cannot detect runtime compatibility issues.
    • It’s not the most robust checker for PHP 8 issues. It worked great for PHP 7.4 compatibility but has not kept up with all the PHP 8 changes. Additionally, if your website is large, or has lots of plugins, it tends to get bogged down. It’s best at checking a single theme or a very small subset of plugins at a time.
  2. Manually Check with PHPCS and PHPCompatibilityWP:
    • If you prefer a more hands-on approach, you can use PHPCS (PHP CodeSniffer) along with the PHPCompatibility/PHPCompatibilityWP ruleset. This is definitely a developer focused method to checking the website’s code. It does require that you have terminal access to the server hosting your website, or that you migrate a copy of the site to a local development environment, such as LocalWP or Dev Kinsta.
  3. Ask your web host for assistance. Some will be able to provide generic testing.
  4. Reach out to Cap Web Solutions. We can do this testing for you. It will be performed offline so as to not impact the operation of your website. The outcome will be a report detailing the issues found, if any, and the recommended course of action to address. Any actions that we can perform will include an estimate of the time / cost to address.

Remember to thoroughly test your website after making any changes to ensure everything works as expected. 

Need Help Testing for PHP 8.1 Compatibility?

PHP 8.1: The New Minimum Recommended Version

Splash screen announcing PHP 8.1 release.

The recommended minimum PHP version for WordPress has evolved over time to keep up with advancements in PHP and to ensure security, performance, and compatibility. The reasons behind the change from PHP 8.0 to PHP 8.1 in the latest WordPress 6.4 release include:

  1. Backward Compatibility and PHP Versions:
    • WordPress aims to support new PHP versions on the day they are released.
    • Historically, WordPress has been cautious about raising the minimum PHP requirement to maintain backward compatibility with older code.
    • However, as PHP evolves, maintaining compatibility with outdated versions becomes increasingly challenging.
  2. Previous PHP Versions Supported by WordPress:
  3. Advantages of PHP 8.1:
    • PHP 8.1 introduces new features, performance enhancements, and security improvements.
    • By recommending PHP 8.1, WordPress encourages users to benefit from the latest language features.
    • It ensures that WordPress core, themes, and plugins can take full advantage of PHP advancements.
  4. Security and Performance:
    • Using older PHP versions poses security risks due to unpatched vulnerabilities.
    • PHP 8.1 includes security enhancements and bug fixes.
    • Performance improvements in PHP 8.1 can enhance WordPress site speed.
  5. Developer Community and Ecosystem:
    • The broader PHP community actively supports and maintains PHP 8.1.
    • Plugin and theme developers can leverage new features and syntax.
    • Encouraging adoption of PHP 8.1 benefits the entire WordPress ecosystem.

The shift to PHP 8.1 reflects WordPress’s commitment to staying current, improving security, and providing a better experience for users and developers.

PHP 8.0 End of Security Support

As of November 26, 2023, PHP 8.0 will reach its end of life and will no longer receive security updates or patches from the community. Here are the implications for WordPress users:

  1. Security Risks:
    • WordPress sites running on PHP 8.0 will be exposed to vulnerabilities.
    • Any CVEs (Common Vulnerabilities and Exposures) discovered after this date will not be patched by the community.
    • Without security updates, there’s an increased risk of exploits and potential breaches.
  2. Plugin and Theme Compatibility:
    • While WordPress aims to be beta compatible with PHP 8, not all plugins and themes will immediately work flawlessly.
    • Some may encounter fatal errors, while others might exhibit unexpected behavior.
    • Some plugins and themes will need extensive refactoring to ensure compatibility with PHP 8.0.
  3. Deprecated Functions Removal (slipping into the developer quagmire here – tread carefully):
  4. Risk of Abandoned Plugins and Themes:
    • The onus of updating code for compatibility with PHP 8.1 could be challenging for some developers.
    • Abandoned plugins and themes may not receive security patches.
    • Sites using such abandoned extensions could face security risks.

Preparing for the Transition to PHP 8.1

It’s Important to Test your Site’s Compatibility with PHP 8.1

Upgrading PHP is comparable to updating your cell phone’s operating system, say jumping onto IOS 17 right away? Or moving to the latest version of the Android OS. Sometimes it’s a breeze, and other times. Well let’s just say we’ve all been there at some point. The point is that you want to be careful. Check your key apps first to make sure they will work with the new OS.

Ther’s nothing worse than completing the update on your device, or your website, and THEN determining that your <insert favorite app or most important website function> no longer works.

Testing for compatibility or reviewing the developer’s documentation is the way to go. Know it is going to work before you hit the “Yes, Update Now” button.

How to Address Common Compatibility Issues

Honestly, most PHP compatibility issues going from PHP 7.x to 8.x are going to need a developer to help. The changes from PHP 5.6, or 7.x to 8 are not minor updates. Some of the code will require some reworking to make sure that it works as expected. Adding a parameter here or swapping a filter name there are but a couple of the issues that will come up. If you are not an experienced PHP developer, you are going to have some trouble.

In some cases, if the developer is not able to, or ready to, make the updates, you may need to replace an out-of-date plugin or theme with something newer that does offer the needed compatibility to move your website to the next level of PHP functionality, security, and performance.

Role of Hosting Providers in Facilitating the Transition

The best part of this is that your website hosting provider can help with the change of PHP. Some providers offer more capabilities than others, depending on the type of hosting plan your website is on. If your website is on shared hosting with a large number of other sites it may take a while to get PHP updated. An update could break a large number of sites. In this case you would want to ask your host to move you to a newer server that does run the preferred version of PHP. Many can handle this type of request during an off time for your website. In most cases, if all goes well, the service interruption is minimal – a few minutes of downtime for a server reboot. An migration to a new server may take longer, with longer downtime. Ask your host.

On some hosts, like WP Engine or SiteGround, depending on the hosting plan you have, you are able to log into the custom portal and select the version of PHP on your own. You control it. In these cases, the portal offers a mechanism to roll back the change if things don’t go well.

Customers hosted on Cap Web Managed Hosting need only to send in a support request to request that PHP be changed to anything from 8.0 to the latest 8.2 release.

Steps to Upgrade to PHP 8.1

Find out Which PHP Version You’re Using

In WordPress 5.2, a tool was introduced called “Health Check” before this Health Check was a separate plugin that you could install. Log into your website dashboard and browse to the “Tools” menu on the left side of your screen. When you hover over it, you should see “Site Health.” Select that and the main Site Health tab will display various pieces of information and even highlight some aspects of your website that need attending to. Select the “Info” tab. Here you will see a lot of items you can click on, but the one that we are interested in is the server.

Click that, and you’ll then see the server information indicating the PHP version. Here is an example of a server running a very old version of PHP – 7.4.

Screenshot of WordPress dashboard showing Health Check Info screen PHP 7.4 server section.

This website runs much more slowly than it needs to due to the poor performance of PHP 7.4 as compared to 8.x versions. Plus, the fact that PHP 7.4 stopped receiving any type of security updates more than a year ago in November 2022.

The two screenshots below show servers running 8.0 and 8.2. Each iteration up the release ladder of PHP brings additional functionality and greater performance.

How to Upgrade PHP

Backup and staging considerations

The first step in any type of major website update is to remember to backup your server and your website before upgrading to PHP 8.2. This way, you can revert to the previous PHP version if needed. The server backup will be handled by your hosting company during the update process. The website backup is on you, as the website owner, to make happen.

If your web host offers a staging area for your website this is a great opportunity to take full advantage of it. Using the hosting portal, you should be able to copy your current website over to the staging area. That way the staging server is an exact duplicate of your live website. Once you have verified that the staging copy of your website is up and running, log into the staging site (you will be able to use the same username and password as on your live site – it is an exact copy) and grab a backup of it as well.

Testing procedures and troubleshooting

Once you have updated the hosting server to PHP 8.2 look through the front end of the website first. Visit some of the most important pages on your website to make sure they are displaying properly. The front page is your first stop, then any pages having contact forms, your online store (if applicable), pages where users can log into the site, or post comments on blog posts. Don’t forget pages with animations – sliders, counters, filters, and so on.

If everything looks good on the front end (the part of the site that is seen by your visitors) log into the dashboard of the website using an administrator account and look for any notices that may be displayed. This would be a good indication that something needs to be further investigated. It could be a plugin that needs updating, or possibly your active theme. If so, reach out to the developer of either, to ask for assistance. They will want to know what version of PHP you are trying to upgrade to.

Wrapping It Up

Importance of keeping WordPress and PHP up to date

  • PHP is the programming language on which the WordPress code is based.
  • It runs on the server and is critical for both security and functionality.
  • Keeping PHP updated is essential to address security vulnerabilities and maintain compatibility with modern web technologies.

Act now to ensure your WordPress sites are secure and performant

Cap Web Solutions encourages everyone to work with their hosting company to make sure your website is operating at its best. Running your website on PHP 8.1 or, better yet, 8.2, ensures that your WordPress site runs optimally and takes advantage of the latest features and performance improvements offered by newer PHP versions.

Still running a website on PHP 7.4, or ghast, 5.6? Here’s a great blog post that appeared on the WP Tavern blog 3 years ago titled Getting Your WordPress Plugins and Themes Ready for PHP 8. It offers some excellent resources for updating your WordPress themes and plugins to meet PHP 8.x requirements. Updating to that point is the first step in making sure your website will perform as expected on WordPress 6.4 and PHP 8.1.

Need help with this update? Please reach out to Cap Web Solutions. We can work with your hosting company and make adjustments to your custom themes and plugins that may need tweaking for PHP 8.

If you are already hosted on Cap Web Managed Hosting, you have no worries. Our servers are all running PHP 8.1 or higher. You and your website are good to go.

Thanks for sticking with me all the way to the end. It’s been a tough slog. Hopefully you got something out of it. If you have any feedback, I’d love to hear it. What has been your experience with upgrading to PHP 8.1 or 8.2? How did the WordPress 6.4 upgrade go? Drop it in the comments below or send a note using our Techie Feedback form.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.