Apart from the Docker environment, we also need a Drupal site setup. You can see the docker-compose.yml and Dockerfile on Github. I don’t do any fancy setup with MariaDB as this is just for experimentation. There’s an official one, but I am more used to the Bitnami one as Lando uses it. The other service in the docker-compose file is for MariaDB and I use Bitnami’s Docker version here. (I eventually added them in the image anyway.) That meant that the common PHP extensions such as APCu and YAML wouldn’t be available, but that’s okay for the first attempt. The only difference is that as pecl is no longer included with PHP (as of PHP 8), I just removed those lines. I already maintain a collection of Drupal optimized PHP images and I only adapted that to work with the PHP 8 beta 4 image. We use the last one here and add various PHP extensions and settings optimized for Drupal. The Docker and PHP community maintain a great starting point in the form of official PHP Docker images in a variety of flavors: CLI, FPM, and with Apache on Buster. ![]() I only need two services to begin with–a web server container (with PHP) and a database. Anyway, docker-compose is much simpler for something like this. But that wouldn’t fit my needs here because Lando doesn’t support PHP 8 yet. At Axelerant, we usually use Lando for setting up a project (in fact, our project template tool supports generating a default scaffold for Lando). Problem 1: Environment and initial setupĭocker is great for setting up quick environments for testing and development. ![]() ![]() I will also not try to explain all the changes that have gone in to support PHP 8. I’ll just talk about the parts that I analyzed, reviewed, or changed myself. This makes the challenge of supporting PHP 8 in Drupal even bigger as we have to support several breaking changes simultaneously.Īlso, many of the problems may not be relevant to applications that need to run on one version of PHP as they just have to change code to match the changes in PHP 8. The challenges I describe here are more relevant to applications that need to support a spectrum of PHP versions, not just one or two.ĭrupal 8 supports PHP 7.0 to 7.4 right now and the issue I mentioned earlier also tries to add support for PHP 8 to Drupal 8.9 as well (it looks like it might just happen as well). Secondly, I hope that parts of this article will be useful to people who are trying to upgrade their own complex applications to work with PHP 8. It serves as documentation that can help throughout the process of experimentation. Why am I writing this then? For one, I believe writing down things helps clarify the ideas and goals. It’s clear that this article may not have any value at all in some time when Drupal 9 officially supports PHP 8, along with all of its dependencies. To make it even more fun, I also used Composer 2 for all of these steps. That is the patch I started with when I wanted to test Drupal 9 with PHP 8. These fixes went into a single issue so that we could run a single test against PHP 8. ![]() And as releases started rolling out, there were individual issues to address each deprecation, changed method signatures, and other breaking changes. The Drupal community began planning to fix the compatibility issues early on. Getting Drupal to work on PHP 8 is not as simple as getting it to work on a new minor release such as PHP 7.4. PHP 8 adds a lot of exciting new features, but at the same time, being a major version, it breaks a lot of previous behaviors and functionalities. In fact, the chances are that by the time you read this, we might even have the first RC.
0 Comments
Leave a Reply. |