Goal
The key goal is to provide the basic steps for compatibility scanning and deploying PHP 8.1 across your environments and applications.
Overview
This tutorial looks to provide a list of tools and processes that customer teams may use to efficiently update your existing applications on Acquia to PHP 8.1.
It will also cover requirements specific to existing Drupal versions.
See PHP End of Life Resources if you would like to explore Long Term support options.
Requirements
- PHPCompatibility Library
- PHPDeprecationDetector
- Access to Acquia Cloud UI and permissions to administer system settings
- Ability to create a support ticket
- Drupal:
- D7 - PHP 8.1 supported with version 7.79 Follow: https://www.drupal.org/project/drupal/issues/3224299 for latest information
- D8 - Recommended to upgrade to Drupal 10
- D9 - Recommended to upgrade to Drupal 10
- D10 - All versions
-
Initial Scans
The first and best preliminary step is to start scans on local environments to help detect possible errors prior to switching the PHP version.
The PHPCompatibility library can be installed locally via composer. See: https://github.com/PHPCompatibility/PHPCompatibility/blob/master/README.md
This tool can be run to check compatibility without setting the environment to the target PHP version up front so, one may run checks while still using their current PHP version.
Once installed the scan can be run via the following command:
phpcs -p /path/to/codebase --standard=PHPCompatibility --runtime-set testVersion 8.1
That command should target the project root and not just the docroot to ensure that all of your code is covered including possible dependencies from composer.
-
Review and Update Code
Once the report is generated from the tool, review the listed possible warnings and errors.
The key things to focus on that may be flagged by the tool could be:
- Libraries, etc. included by composer
- Drupal core and modules
- Custom code (modules and themes)
- Drush Version. See Drush's docs on PHP compatibility.
Pending which of the above that may have been flagged, take the time to update any contributed projects/modules to the latest compatible versions.
Other Recommendations
It is also recommended that you may develop a series of functional and regression tests with tools such as Behat, where you may be able to automatically and consistently test your application. This will also help to maintain consistency with future upgrades.
Follow Up
For any issues or other questions that may arise during these steps please do not hesitate to reach out to Acquia Support and your TAM!