how to migrate drupal 8 to 9
5 November 2023

Drupal 9 was released to the public in June 2020, when Dries Buytaert, the founder of Drupal and project leader, said Drupal 9 was " the most author-friendly and powerful version of the platform to date."

Why Migrate to Drupal 9?

When official support for the D7 only ends in 2022 (at the same time as the D8), security updates, bug fixes, and the development of new modules for these versions will also end. This opens your system to the risk of cyberattacks, potential downtime, and a lack of up-to-date features that your customers can expect from your web presence.
 
Entering directly into the new build with D9, you benefit from receiving long-term official support from the Drupal community including security releases that help protect your website from various vulnerabilities. D9 also removes outdated code and uses a new version of PHP, which is important for security.

How to start preparing the site for the upgrade to Drupal 9?


If you are in Drupal 8, the best way to configure Drupal 9 is to comply with the release of minor versions and update the deprecated
code. According to Drupal, you should "completely update your Drupal 8 site to the most recent version of the offered modules and themes, before updating to Drupal 9."
The deprecated code will not be based on Drupal 9, but there are ways to search your system and update the specified code. Here is a website administrator module for discounted code: Upgrade status module.
 
Steps to Migrate Drupal 8 to Drupal 9 

Migrating from Drupal 8 to Drupal 9 is an easy task, these are the following steps to migrate from Drupal 8 to Drupal 9.
 
 
1: My current version is Drupal core: 8.9.16, first I want to upgrade the core and modules of Drupal 8 to the latest version, and then Drupal 9.

image

2: Download the Upgrade status module, after enable the module check the status of the current website.
 

Your-site/admin/reports/upgrade-status

 

imageIn my case the site status is about 90% upgradable, some codes are deprecated which is not working properly in Drupal 9, to check the deprecated code run the drupal-check command, which shows the deprecated code in Drupal 8 site.
 
Also, check the status of the module as well, If you have custom code, use Drupal Rector to identify code that needs to be updated, in many cases, can be automatically upgraded to Drupal 9.
 
3: Remove deprecated code if there is any, and then run composer update command in Drupal 8, which updates the modules to the latest version of Drupal 8.
 
4: Update composer.json file by running this command

composer require drupal/core-recommended:~9.2.5@dev drupal/core-composer-scaffold:~9.2.5@dev --no-update --update-with-dependencies

 
5: And then run composer update command again to download the latest version of Drupal 9, clear the cache, and boom your site is migrated to drupal-9

image
In this case, the core is updated successfully to Drupal 9.2.5 (latest release) to date.

image

Conclusion

To wrap things up, we recommend that you upgrade to Drupal 9 soon. It has an easy upgrade process, and there are many options you can upgrade depending on which Drupal version you currently have.
 
Don't wait - Drupal 7 sites will have long support, but those with Drupal 8 will not have extended support after reaching the end of life in November 2021.
 

Ishfaq Ahmad
Sr. Drupal site Builder/ Drupal Themer/Drupal Module Developer

Add new comment