Title: Prepare application code for a PHP version update
Author: WordPress VIP Documentation
Published: April 28, 2022
Last modified: December 26, 2023

---

 1. [WordPress on VIP](https://docs.wpvip.com/wordpress-on-vip/)
 2. [PHP](https://docs.wpvip.com/wordpress-on-vip/php/)
 3. [Version updates for PHP](https://docs.wpvip.com/wordpress-on-vip/php/versions/)
 4. Prepare application code for a PHP version update

#  Prepare application code for a PHP version update

PHP is continuously under development to improve performance and security with every
released version. Though every version brings improvements, sometimes new requirements
for code syntax or breaking changes are introduced as well.

It is important for developers to set time aside to prepare an application’s codebase
for a PHP version update. This helps to ensure that an update process is as smooth
as possible.

Refer to [the PHP Manual Appendices](https://www.php.net/manual/en/appendices.php)
for more details about the changes included in newer versions of PHP.

## Methods for scanning and testing code

Developers should begin the process of a PHP version update by using some or all
of the following methods to identify potential compatibility issues with a newer
version of PHP:

Several methods are available for identifying potential compatibility issues in 
application code with a newer version of PHP. Developers should begin the process
of a PHP version update by scanning application code with as many methods as possible:

 * [PHPCS scans for PHP version compatibility](https://docs.wpvip.com/wordpress-on-vip/php/versions/phpcs-scans/)
 * [PHP linting for PHP version compatibility](https://docs.wpvip.com/wordpress-on-vip/php/versions/php-linting/)
 * [Static analysis tools for PHP version compatibility](https://docs.wpvip.com/wordpress-on-vip/php/versions/static-analysis/)
 * [Automated tests for PHP version compatibility](https://docs.wpvip.com/wordpress-on-vip/php/versions/automated-tests/)

After scanning code locally and making updates to application code to resolve identified
incompatibilities, additional testing should be performed on a non-production VIP
Platform environment.

 * [Test application code for a PHP update on a VIP Platform environment.](https://docs.wpvip.com/wordpress-on-vip/php/versions/platform-environment-tests/)

## Code that should be scanned and tested

When preparing for a PHP version update, all code in [an application’s GitHub repository](https://docs.wpvip.com/wpcomvip-github-repository/)
should be scanned and modified as needed for compatibility. An application’s codebase
likely includes a combination of custom code written specifically for that application,
as well as third-party code written by authors not associated with the application’s
development team.

PHP development tools such as Composer, PHPUnit, PHP_CodeSniffer, PHPStan Several
methods are available to prepare for a PHP version update requires several steps
including local code scanning and modification as well as performing tests on a 
non-production VIP Platform environment.

### Custom plugins or themes

All custom code added to an application’s GitHub repository must be scanned and 
tested for compatibility for a PHP version update. The developers who originally
wrote the custom code are often the best candidates to perform scans and make necessary
updates. However, the feedback provided by the recommended scanning methods is actionable
by any PHP developer familiar with the application’s codebase.

### Third-party plugins or themes

If PHP incompatibilities are found in the code for third-party plugins or themes,
they can be reported to the plugin or theme authors. Some authors are quick to respond
to upcoming versions of PHP and release updated and compatible versions of their
plugin or theme.

Customers can also optionally consider:

 * Adding a different, alternative plugin or theme that is compatible with the next
   version of PHP and provides the same functionality. All third-party plugins and
   themes should be [evaluated for performance and security](https://docs.wpvip.com/third-party-plugins/)
   before enabling them on a production environment.
 * Forking the plugin code where modifications can be made to the code to make it
   compatible with the updated version of PHP. Choosing this option places the responsibility
   of maintaining the forked code on the customer’s development team.

Last updated: December 26, 2023