Drupal 8 to Drupal 9 upgrade showcase

Submitted by gazza on Fri, 05/06/2020 - 21:40
drupal 9 upgrade showcase

Drupal 9 was officially launched 2 days ago (3rd June 2020) so I thought what better way to check it out than to do an actual real life Drupal 9 upgrade. My company website (My Local Trades) was running Drupal 8.8.x and 21 enabled contributed modules. 

After reading through the Drupal documentation on upgrading from Drupal 8 to Drupal 9 I felt I had the tools for the job. Whist upgrading I did encounter a few issues and errors that I needed to resolve (I didn't ever expect that when I read upgrading from Drupal 8 to Drupal 9 would be as easy as updating from a minor version!)

I started off by installing a fresh version of Drupal 9 on my server as a dry run.

The first issue I encountered was the dedicated server I use for the My Local Trades website was running Database MariaDB version 10.2.x - Drupal 9 seems to require MariaDB version 10.3.x and higher. Thankfully the server runs Plesk on CentOS 7 so I headed over the the Plesk support documents and followed the instructions here to upgrade the database version at the command line: https://support.plesk.com/hc/en-us/articles/213403429--How-to-upgrade-MySQL-5-5-to-5-6-5-7-or-MariaDB-5-5-to-10-0-10-1-10-2-10-3-on-Linux-

Drupal also required me to update my php version from 7.3 to 7.4. This was a simple job using the plesk UI. According to the Drupal documentation, Drupal 9 will run on PHP 7.3. This is not what I have found. When enabling PHP7.3 the site goes offline and happliy comes back when switching back to PHP 7.4

Once my fresh test installation of Drupal 9 was running successfully on the server, I then moved on to upgrading My Local Trades. As always with Drupal, I made a backup of the current sites files and database and placed this safely on another server. I then updated Drupal core and all contributed modules to their latest recommended versions. I then replaced the drupal files, keeping the existing sites, modules and themes folder along with a couple of custom files at the root of the installation, with the Drupal 9 files. I then headed to /update.php and waited a few seconds....

This is the point where I didn't actually expect update.php to run without issue. Indeed it did not! I received a few errors, two were due to a couple of contributed modules that were not compatible for Drupal 9. Thankfully these were not essential so I reinstated my backup installation and removed these through the UI. I then repeated the above and attempted to run update.php again. This time I was left with one error before I could upgrade.

Drupal 9 config_sync_directory not defined in settings.php! This meant that in the current Drupal 8 settings.php file, Drupal 9 could not read or find the config sync directory. According to the Drupal documentation, (https://www.drupal.org/node/3018145) from Drupal 8.8.x a new sync directory setting has been introduced. In theory, when I upgraded from Drupal 8.8.x to 8.9.0, the settings.php file should have already been using the new setting. This was not the case.

This was the setting in my Drupal 8.8.x settings.php file:

$config_directories['sync'] = 'sites/default/files/config_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/sync';

So I changed this line to:

$settings['config_sync_directory'] = 'sites/default/files/config_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/sync';

as the configuration sync directory is now defined as: $settings['config_sync_directory'] in settings.php

I then headed back to update.php and guess what??? It worked!!! I then built and styled a new theme and this is the outcome: https://www.my-local-trades.co.uk/

Overview of server requirements:

PHP version 7.4

MariaDB Databse version 10.3.x