Drupal 8 to 9 Upgrade: Prerequisites, How-to and Other Tips!
Apparently, technology is evolving with time, and it ought to be. Because if it will not evolve, then it will become obsolete. There are many examples available of things that didn’t change with time; they got vanished.
The same happened with our favorite Drupal. We all liked Drupal 7 and then updated to Drupal 8. It also succeeded in impressing us. After using Drupal 8 for many years, now is the time for Drupal 9 migration. It is now mandatory because Drupal 8 has already reached its end-of-life in November 2021.
There might be some users who would’ve upgraded to Drupal 9. But there can be some who are still operating the previous version (Drupal 8). Let’s help them and find out how to upgrade to Drupal 9?
How Drupal 9 is different from Drupal 8?
Drupal 9 is not entirely different from Drupal 8.9. Drupal Developers have only eliminated the deprecated APIs and used updated dependencies. Drupal 9 is based on a continuous innovation model; thus, you don’t have to be ready for major changes like you get in previous versions.
Drupal 9 has more features and amazing themes. To know more about Drupal 9, switch to this version now.
Prerequisites to upgrade to Drupal 9
You need to know a few prerequisites before you upgrade to Drupal 9.
- You should be using either Drupal 8.8 or Drupal 8.9 if you want to upgrade to Drupal 9. The new upgrades are only meant for these two minor versions and not for previous ones.
- All the modules should be updated to their latest versions. Old modules are not compatible with Drupal 9.
- To upgrade to Drupal 9, your hosting environment ought to fulfill the minimum system requirements.
- Check and remove all the deprecated codes.
If this checklist is done, then you can start the upgrading process.
Tools that help in Drupal 8 to 9 Upgrade
There are a few tools readily available to you to complete the upgrade process. In the Drupal 9 upgrade, deprecation and compatibility are the two main factors to pay attention to and these tools will be your savior in this journey.
Code editor or IDE
They understand the deprecation codes and identify them easily.
With the help of this tool, you run a standalone PHP executable from your command line, and it checks all the deprecated codes with Drupal 9 compatibility.
This module is more or less similar to Drupal check. Upgrade status scans the complete site and alerts you if any deprecated code or incompatible module is there on the site. It also suggests you what updates are required to meet the system requirement.
It helps you in two ways, 1. The way above two tools (Drupal check and Upgrade status) assists you, and 2. It configures the module’s test suite if you don’t find the correct deprecated code path. The complete test helps to get the best results.
It helps find deprecated codes with an automated system. Rector easily finds custom and contributed modules that need to fix.
These are five tools that can help you in finding and fixing the problem of compatibility and deprecation. Out of five, you can choose anyone, which is handy to you.
Composer based Drupal 8 site upgrade to Drupal 9
Perform the following steps from your Drupal site’s core (composer.json):
- To protect files and directories, temporarily add write access
- chmod 777 web/sites/default
- chmod 666 web/sites/default/*settings.php
- chmod 666 web/sites/default/*services.yml
- Pull in Drupal 9 version of ‘core-recommended’ and ‘dev-dependencies’ packages as dependencies.
- composer require ‘drupal/core-recommended:^9’ ‘drupal/core-composer-scaffold:^9’ ‘drupal/core-project-message:^9’ –update-with-dependencies –no-update
- If you have ‘drupal/core-dev’ installed:
- composer require ‘drupal/core-dev:^9’ –dev –update-with-dependencies –no-update
- Now update the code
- composer update
- If any of your modules or code are not updated as per Drupal 9 prerequisite, then you will get an error here while updating the codebase. So, ensure you have achieved the prerequisites before you start to upgrade.
- You can also add alias to ‘drupal/core’,
- composer require “drupal/core:9.0.0 as 8.9.0” –no-update && composer update
- When you update the module code and if the module needs the update, then run the pending database updates by visiting update.php in the browser or with Drush.
- drush updated
- Complete or restore read-only access to the site
- chmod 755 web/sites/default
- chmod 644 web/sites/default/*settings.php
- chmod 644 web/sites/default/*services.yml
Also, ensure you change the entry in ‘composer.json’ file after a successful upgrade if you are doing this process for an upgrade to Drupal 9 from Drupal 8.9. Otherwise, you will not be able to install Drupal updates.
Don’t forget to follow this Drupal maintenance checklist to keep your Drupal website up to date!
If you are still using Drupal 8, then your site is at risk. You are running a site that has no security promises with ample loopholes since the version is not live now. So, to protect your database, and to maintain the performance of your site, you should now upgrade to Drupal 9.
Hopefully, the above-mentioned steps will help you to upgrade to Drupal 9 smoothly. If you need any further assistance, then outreach to a professional Drupal developer to avoid any inaccuracy in the upgrade process.
If you are looking for a Drupal 9 migration, web development, Drupal commerce development and other related web development services, for more information, please explore our Drupal web development services! We also provide Drupal website maintenance services, Drupal migration and Drupal application security audit. For more information, please visit our Drupal maintenance services!