Add new comment

Running Drupal 8 on PHP 7

Difficulty: 
Piece of Cake

[Check out or free Installing Drupal 8 on PHP7 tutorial]

Drupal 8 was released with full PHP7 support:

[META] Support PHP 7

But the fact that the Drupal 8 codebase is able to run on PHP7 does not mean that you can run PHP7 Drupal 8 deployments. Why? Because there is more than just "Drupal" to run a decently performing Drupal 8 based application.

There are at least 3 additional components that need full PHP7 support:

  • In-memory caching (Wincache/APCu)
  • Database PDO driver
  • Key/Value store or NoSQL alternative for high performance caching

Depending on what your software stack is these might be ready or not yet.

Our stack of choice is Wincache + SQL Server + Couchbase. The reasons are varied, but these (at least the two last of them) are enterprise level products that outperform their competitors in many ways, will scale without issues and keep innovating at a faster peace than their competitors do.

For example, SQL Server 2016 with the improved in-memory tables feature is able to speed up database operations (including transactional ones, joins and other complex situations) up to x15 without changing a single line of code (you will need some extra RAM but with today's pricing that is not an issue).

Couchbase is x4.5 faster than MongoDB.

So how is each one of those components ready for PHP7 and Drupal 8?

  • In-memory caching - Wincache: I have been working closely with the maintainer on the last releases, and both 2.0.0.6 (for PHP 7) and 1.3.7.10 (for PHP < 7) and these are both production ready. Special thanks to Drophone for his continued - and personal he is not getting paid to work on this - efforts on this PHP extension. We uncovered and (he) fixed some tough bugs that were affecting Drupal 8. The Drupal Wincache module has also been brought up to date, updated to Drupal 8 and made PHP 7 ready. 
  • Database PDO driver - MSSQL: The MS team is working intensively into making PHP 7 on SQL Server a reality, and providing Linux support. You can follow their work here . With the latest release (4.0.4) installing Drupal 8 using PHP 7 is now a reality. The Drupal SQL Server driver has been tested and updated to work with PHP 7 and the latest PDO driver from Microsoft. Bugs in PHP itself were fixed in order to make the MSSQL pdo driver work and the minimum required PHP7 version is 7.0.6
  • Key/Value - NoSQL - Couchbase: Early work has been posted by the Couchbase team, but no official PHP binaries yet. We recommend to hold on before trying PHP7 with Couchbase until a more stable release is made and an official statement done regarding PHP7 support.

Overall, you can start deploying Drupal 8 on PHP7 for applications that will need not to rely on Couchbase. I am wondering if that will ever be needed, considering that with the new in-memory enhancements fo SQL Server 2016 cache backends can be tunned to work x15 times faster with just some more RAM.

I would like to give special thanks to Drophone and the MSSQL Server team for making this a reality.

What to expect from here on?

Now that there is full SQL Server and Wincache support for Drupal 8 since - more or less - day 1, our customers are asking for Azure Apps support. The latest Drupal SQL Server driver is 100% comptatible with Azure SQL V12. On the upcoming months, I will be releasing specific guides for deploying Drupal 8 (and probably 7) on Azure Apps.

Why using Azure Apps? There are lots of reasons and these are some:

  • Host anything from brochureware (from €5/month) to sites with millions of hits with predictable performance (yes this is no crap shared cloud hosting)
  • Infrastructure as code.
  • Automatic deployment slots per branch.

There's much much more to azure apps, but you can see that this is just awesome devops from a reliable provider.