This document aims to be an all-encompassing guide for the upcoming PHP upgrades and how the affect Drupal
Update Process
Pantheon
Update the
pantheon.yml
with a PHP version increment (php_version
)Create a branch with the changes and deploy it to a multidev
The multidev will not update the upstream by default as Pantheon does not read those changes by default on multidevs. The easiest way to force an update is to clone the multidev’s branch, and push a small update to the file directly to Pantheon.
Test, test, test
Check critical paths and modules for compatibility
Once the compatibility is confirmed, merge to master and deploy
Acquia
Acquia PHP updates are most easily achieved using the UI:
https://docs.acquia.com/cloud-platform/manage/php/
Compatibility Checking
If you need to do compatibility checking amongst a large surface area, (such as all of your composer dependencies) you can simply use PHPCS with PHPCompatibility.
composer require squizlabs/php_codesniffer --dev
composer require phpcompatibility/php-compatibility --dev
Add the script to composer.json:
"sniffer:php8.1": "phpcs -p ./web/ --ignore=*/node_modules/*,**.js,**.css --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 8.1"
Which can be then invoked from the command line like so:
composer sniffer:php8.1
Facts as of June 30th 2022
Drupal’s last version which supports PHP 8.0 is Drupal 7.79
PHP 8.1 is only Supported by Drupal 9 & 10
There does seem to be an effort to add Drupal 7.X to higher versions of PHP: https://www.drupal.org/project/drupal/issues/3224299
Drupal 10 will drop support for PHP 7
Drupal 9.4 will drop support for PHP 7.3
Should we ever need to run PHP locally, there are a few packages that PHP now depends on: https://www.drupal.org/docs/system-requirements/php-requirements#extensions
There are some configuration defaults that change if you are running PHP locally: https://www.drupal.org/docs/system-requirements/php-requirements#configuration
Lando’s minimum support for PHP 8 is 3.5.3, so local versions should be updated by each developer: https://docs.lando.dev/getting-started/updating.html
DDEV supports PHP 8 by changing the configuration in the
.ddev/config.yml
file