PHP 8 and WordPress: time to upgrade

PHP 8 and WordPress: time to upgrade - The White Label Agency

It is time to upgrade your WordPress instances to PHP 8. Indeed, PHP 7.4 will no longer be supported after Nov 28, 2022. This is the official end-of-life (EOL) date listed on PHP.net and represented by the red dashed line on the PHP Group’s life cycle chart below. 

PHP 8 and WordPress - end of life for PHP 7
Source: PHP.net

The team that addresses security issues that may arise for the PHP 7.4 version will no longer investigate or handle them with a fix. Older versions of PHP lead to a slower experience for website visitors and leave them vulnerable to security risks. Agencies that have not switched to PHP 8.0 should strongly consider doing so before the November 28 date. 

Although PHP 8.0 has been active since late 2020, and the benefits of switching are apparent, many existing WordPress websites are running unsupported versions of PHP. As of October 2022, W3Techs reports that PHP version 7.4 is still the most widely used version across live websites running on the server-side language. 

PHP versions currently used by websites
Source: W3Techs

Certain hosting companies, such as WP Engine / Flywheel, have announced that their development teams will take on extended security support past the November 28th end-of-life milestone. There is no listed expiration date for this unique continued support.

Even with third-party support extensions, the support for PHP 7.4 will eventually end. If your agency has a website, or multiple websites, running themes or plugins that their original authors are not supporting, it may be time to consider a rebuild. 

As an agency, what specific actions should your organization take to stay on top of PHP updates from PHP 7.4 to PHP 8.0?

The following sections will provide high-level directions on addressing the EOL of PHP 7.4 and upgrading to PHP 8.0.

Take Inventory of Client Websites

The first step an agency should take is to check what PHP version is running across their sites. Some hosts, such as WP Engine, will list the PHP version under their administrative controls section, while others require contacting support directly.  

WP Engine hosting panel and PHP version
Source: WP Engine Hosting Panel

If the PHP version listing is not readily available, WordPress Site Health Tool found under the WP Admin dashboard can be used. Login with an administrator-level username and then go to Tools > Site Health > Info and check the Server section.  

WordPress site health and PHP info
Source: WordPress site health

If outdated PHP versions are discovered while taking inventory, it is recommended to update them to at least PHP version 8.0. Some hosting providers will make the switch automatically, some will require it to be done manually via their control panel, and others require contacting support and requesting them to perform the switch. With any of these options, testing is necessary before making the switch.  

Test Compatibility of Themes and Plugins

Not all WordPress websites will easily transition to the latest version of PHP. It is essential to test the existing code on the site (themes, plugins, and scripts) for compatibility. If one of these components is not compatible, it could result in a part of the site breaking or experiencing performance issues. 

Below are two recommendations for setting up an environment to test the PHP changes. The first involves setting up a staging environment through a host, and the second consists in setting up a local server environment on a computer. 

Staging environment via host provider

Using a staging location on your current host is highly recommended. This will allow you to see all site components on the latest version of PHP but will not impact any visitors to the live location. Multiple hosting providers have tools to set up a staging area. Then the PHP can be adjusted via the control panel or by contacting the technical support team and having them do it for you. 

Local development environment 

A local development environment may include more steps, but it is also a great way to test PHP version changes safely. There are many options for this, such as Local by WP Engine, that allow you to set up your computer to replicate the hosting environment and test settings such as the PHP version the code is running on. 

With either of these options, perform the following:

  1. Take a backup of the entire WordPress website and database
  2. Ensure that WordPress core and all plugins are up to date
  3. Change the environment from your current PHP version to 8.0 or above
  4. If the site breaks immediately, try deactivating all plugins and themes and then reactivate one-by-one to try and isolate which specific one is not compatible 
  5. For those plugins/themes that were found to be incompatible, check to see if there are any updates available or reach out to the developer regarding readiness for PHP 8.0
  6. Once the site is up and running, proceed to test the front-end


Perform a thorough review after updating the PHP

Since the updated website will be on a local environment or staging, it can be thoroughly tested before replicating the live environment changes. Have a team member review the front end of the website for any impacts to page layouts, code being displayed, or any error codes appearing. 

The functionality of different components of the website should also be checked. Review all contact forms and call-to-action buttons. A test purchase should be made if the website is running e-commerce. 

If issues are found, take screenshots and note the discrepancy between the live and updated test site version. These notes will help developers identify potential solutions to have the site fully compatible with the latest version of PHP. 


Go live with PHP 8.0

After all successful testing on local or staging sites, it is time to implement the PHP switch on the live version of the website. Make sure to take a backup of the site, just in case it needs to be reverted.  

Changing the PHP version is a server change. Depending on the host, there will be the option to change it manually via logging into the host control panel or contacting the technical support team to make the change. 

Just as with the staging/local testing website, make sure to make a visual and functional change to the front end of the website after the change has been made. 


Getting help with  PHP 7.4 to PHP 8.0 updates

Major updates of PHP come with many feature changes that improve the functionality, efficiency, and stability of WordPress websites. However, not all agencies have the time or resources to address the update if complexities arise. 

Hosting providers should be able to address changes to the PHP version directly but may fall short or offer no support addressing compatibility issues of WordPress components. 

Theme and plugin developers should stay on top of PHP changes and ensure their code is updated to be compatible. If it is not the case, reach out to the theme or plugin author to see if an update has, or plans to be, provided. 

If the theme or plugin no longer receives regular updates, it may be time to consider substituting for another or possibly rebuilding part or all of an outdated website. 

White Label Agency offers WordPress design/development, maintenance, and hosting services. Reach out to our team, and we will be happy to assist you in investigating your current setup and recommending a proper course of action. 


Conclusion 

Significant changes to PHP come around on a routine basis, but it typically is not the highest priority for agency operators. The release of PHP 8.0 is no different. Many agencies find themselves running older versions with the November 28th end-of-life milestone right around the corner.