/
PHP 8.x Upgrade Considerations

PHP 8.x Upgrade Considerations

reviewed 230530

This document aims to be an all-encompassing guide for PHP upgrades and how they affect Drupal


Update Process

Pantheon

  1. Update the pantheon.yml with a PHP version increment (php_version)

     

  2. Create a branch with the changes and deploy it to a multidev

  3. 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 from the Pantheon repo and push a small update to the file directly to Pantheon.

  4. Test, test, test

    1. Check critical paths and modules for compatibility

  5. 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.

  1. composer require squizlabs/php_codesniffer --dev

  2. composer require phpcompatibility/php-compatibility --dev

  3. Add the script to composer.json:

    1. "sniffer:php8.1": "phpcs -p ./web/ --ignore=*/node_modules/*,**.js,**.css --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --runtime-set testVersion 8.1"

  4. Which can be then invoked from the command line: composer sniffer:php8.1

Facts (as of May 30, 2023)

  • Drupal 7 supports PHP 8.2 as of version 7.94

  • Drupal 10.0.0 is the first modern version of Drupal with PHP 8.2 support

  • PHP 8.1 has been supported since 9.3.0

  • PHP 8.0 since 9.1.0

  • Drupal requires some PHP extensions, this should be called out by Composer, but you can see the details in the docs.

  • There are some configuration defaults that change if you are running PHP locally: PHP requirements

  • Lando’s minimum support for PHP 8 is 3.5.3, so local versions should be updated by each developer: Updating

  • To update the PHP version on Lando on a Pantheon recipe, change the pantheon.yml file. Changing the Lando config will have no effect.

  • DDEV supports PHP 8 by changing the configuration in the .ddev/config.yml file


Review History

Who

When

Status

Who

When

Status

 

 

 

Bob

20230530

Updated, now Current

Related content

Deprecated Drupal Practices
Deprecated Drupal Practices
Read with this
Drupal 8 -> 9 upgrade guide for existing Pantheon sites using Kalamuna Drupal Project
Drupal 8 -> 9 upgrade guide for existing Pantheon sites using Kalamuna Drupal Project
More like this
Drupal
Drupal
Read with this
Migrating to Pantheon
Migrating to Pantheon
More like this
Quick Tabs module
Quick Tabs module
Read with this
Using Composer
Using Composer
More like this