PHP.net will end support for PHP 7.1 on 1st December 2019. In preparation for this event, Acquia is ending support for PHP 7.1 on 1st October 2019. At that time, we will remove PHP 7.1 from the Acquia Cloud platform and convert all remaining environments at that time to PHP 7.2. This deadline will not be extended, as it is critical your application be upgraded to ensure it's continued security.
Known common issues with upgrading Drupal sites from PHP 7.1 to 7.2 or 7.3 are documented below. This documentation is not intended to be exhaustive, and developers should consult Drupal.org for the most up-to-date information. The following documentation is intended to provide guidance as you work to update your custom code or any contributed modules which are not compatible with later versions of PHP:
Fully updating your application requires several steps:
- Update your local development environment
- Update Drupal core and contributed modules
- Rebuild dependencies
- Update Pipelines
- Update and Deploy to the Acquia Cloud Development environment
Update your local development environment
It’s important that all members of the development team, and anyone who is running the application in their own environment, update their local version of PHP. See your local development environment’s documentation for details.
Update Drupal core and contributed modules
Update Drupal core and contributed projects to the most recent stable release. Only Drupal core 8.5.0 and above is fully compatible with PHP 7.2, and many contributed projects may have fixes for PHP 7.2 in their latest releases.
Drupal 7 specific issues
If you’re using Drupal 7, you may want to apply patches from the following issues to ensure all core tests pass with PHP 7.2:
- [#2885610] Avoid count() calls on uncountable variables
- [#2925449] Function each() is deprecated since PHP 7.2; D7
- [#2946045] Unable to update modules due to Archive_Tar incompatibility with PHP 7.2
For the latest information on Drupal 7, see [#2947772] Fully support PHP 7.2 in Drupal 7.
A number of Drupal 7 applications have been reported to show the following error after updating to PHP 7.2:
PHP Fatal error: Uncaught Error: Call to undefined function cache_get() in /var/www/drupal/includes/module.inc:762
To resolve this error we reccomend updating your settings.php with the following:
ini_set('session.save_handler', 'user');
with
session_set_save_handler(new SessionHandler());
For more information on this issue see https://www.drupal.org/project/drupal/issues/3026449
Upgrades for customers with Acquia Cloud Site Factory and some Acquia Cloud Enterprise applications running Drupal 7.x are no longer blocked
It was previously documented that customers with Acquia Cloud Site Factory and Acquia Cloud Enterprise applications running Drupal 7.x were encountering significant issues during their upgrade to PHP 7.2. This was due to a change implemented in PHP 7.2 by PHP.net deprecating the each() function.
Acquia included a fix to this issue in the Acquia Cloud 1.114.4 release. Customers that were previously impacted by this issue are no longer blocked from upgrading to PHP 7.2. For further details see Release Notes - Acquia Cloud 1.114.4.
Drupal 7 projects known to have issues with PHP 7.2:
Module | Issue | Solution |
(NOTE: This module is not covered by the Drupal security team) |
Module contains deprecated each() function which can trigger PHP notices. |
Apply the patch proposed in: |
better_exposed_filters | Module contains deprecated each() function which can trigger PHP notices. |
There is an issue in progress with an unverified/unsuccessful patch at: https://www.drupal.org/project/better_exposed_filters/issues/2946585 |
migrate |
The following exception is generated in PHP 7.2:
|
Apply the patch linked in the issue below or update to the latest dev version of the module. |
views |
Module displays the following warning: Warning: count(): Parameter must be an array or an object that implements Countable in views_many_to_one_helper->add_filter() (Line 1090 in views/includes/handlers.inc) |
Apply the patch proposed in: |
Rebuild dependencies
Many Composer dependencies only work with specific versions of PHP. You should update your dependencies in an environment that is running your target version of PHP using composer update.
It might also be a good idea to enforce a platform version of PHP that will be used to negotiate dependencies regardless of the host machine’s PHP version. This can help avoid problems that arise when running `composer update` on a host machine that has a different PHP version than a local VM or the remote Stage/Prod environments.
"config": {
"platform": {
"php": "7.2"
}
}
Update Pipelines
If you’re using the Acquia Cloud Pipelines feature, you should update that environment to match your target environment’s PHP version as well. To use PHP versions greater than 5.6, you must be using Pipelines version 1.1.0. Set the version at the top of your acquia-pipelines.yml
file:
version: 1.1.0
Then set the PHP version under services:
services:
- mysql
- php:
version: 7.2
Update and Deploy to the Acquia Cloud Development environment
We advise upgrading your development environment first to detect any potential problems in your codebase. You should then use your staging environment to test any changes that might need to be carried over before upgrading your production environment.
Once you have an artifact generated by a passing Pipelines build or other CI tool, you can update the PHP version on a target Acquia Cloud environment and then push your CI artifact to it for testing:
- Set the PHP version for one of your Acquia Cloud environments by following the instructions found in Configuring PHP settings.
- Once the PHP version has been set, you can deploy your CI artifact by following Code workflows with Acquia Cloud.
Issues
There are potential issues if you are moving your website to PHP 7.2.
- PHP 7.2 dropped support for mcrypt - Websites relying on SimpleSamlAuth are affected by this. Until the reliance on mcrypt is removed, you can work around the issue by using the following commands to add SamlAuth to your project:
composer require onelogin/php-saml:"dev-remove_mcrypt as 2.11.0" composer require drupal/samlauth:^2.0
- Memcache compression defaults have changed - Drupal's Memcache module with PHP 5.6 uses the memcache PECL extension which defaults compression to
on
, while PHP 7.x uses the memcached extension which defaults compression tooff
. This may require modifications to your application. See enable compression by default with memcached extension for additional details.