Tuesday, June 21, 2016

Drupal 7 on PHP 7

We're happy to announce that last week

we successfully upgraded a really complex Drupal 7 based web app to PHP 7 and it works like a charm!


From the upgrade we can measure and feel the performance boost coming with PHP 7! (30-100% performance increase along with a lower memory consumption).

Exact versions? We upgraded from Ubuntu 14.04 LTS and PHP 5.5.9 to Ubuntu 16.04 LTS and PHP 7.0.4 (currently).

Is it a complex project? Yes. It has 277 enabled modules (core, contrib, feature and custom modules together).

Is it a mission critical application? Yes, it's far from a website. It handles sensitive information and used continuously on a daily basis as the heartbeat of an enterprise.

Drupal.org says PHP 7 is not fully supported by Drupal 7 - there is an issue with a solution reviewed and tested by the community, but still open currently. However, there is no aggregated info out there regarding PHP 7 support of contrib modules.

How we took to the liberty of upgrading? How we handled the risks? Simply: we have tests. Yes, automated tests. We have 373 casperjs tests, plus phpunit tests for classes responsible for critical calculations set up as part of a nightly build based on continuous (daily) delivery workflow.

The moral of this story


1. Don't be afraid of running Drupal 7 on PHP 7. Try it, test it and be happy :)
2. Write tests. It's worth it. Of course, this complex D7 project would have been the last to be updated to PHP 7, but we were able to produce quite a nice test coverage, and in this way it came out first! Tests gave us confidence.

We’ve chosen Drupal 8 for most of our new projects since Drupal 8 beta and a huge advantage of Drupal 8 is that it supports PHP 7 out-of-the-box, so you don't have worry about this. But now we see that for projects started in Drupal 7 the future is bright as well.