How to upgrade a Drupal 8 website to Drupal 9 when you're not a developer

It’s called the easiest major Drupal upgrade in a decade. But for me, as a Drupal designer/site builder who doesn't know how to code, it was pretty damn hard. In this blog post I will outline the steps I took to upgrade a Drupal 8 website to Drupal 9.
Robert Roose
By Robert Roose

How to upgrade a Drupal 8 website to Drupal 9 when you're not a developer

Disclaimer

I’m not a developer. I don’t know how to write PHP and hesitantly use the command line. The way I upgrade from Drupal 8 to Drupal 9 might be totally wrong, but it’s also the only thing that worked for me after trying all other available tutorials and guides. So be beware of this before you follow this guide.

Steps I took to upgrade from Drupal 8 to Drupal 9

Before you start this process be aware that from this moment all changes that are made on your live Drupal 8 website won’t be transferred to your newly upgraded Drupal 9 website. So take precautions preventing people from interacting with the website. This whole process can take up to 4-5 hours.

It’s advised to use the Upgrade Status module if you want to upgrade from Drupal 8 to Drupal 9. This module needs to be installed with Composer. Trying this on my Cloudways server gave memory issues. So I decided to set up a local version of my website.

  • Download a copy of the files and database with the Backup and Migrate module of the current live Drupal 8 website
  • Download and install Acquia Dev Desktop 2
  • Extract the files to the sites folder used by Acquia Dev Desktop 2
  • Extract the database (doesn’t matter where)
  • Import a local site with Acquia Dev Desktop 2, pointing it to the right files directory and using the extracted database
  • You might need to change the trusted host patterns in the settings.php to the local development URL which ends in .dd
  • Open a console by clicking on More in Acquia Dev Desktop 2
  • Give the following command:
    drush cache-rebuild all
  • This usually resolves the errors you get when first visiting your local development site
  • Install Upgrade Status with the following command:
    composer require drupal/upgrade_status
  • Login to the local version of your Drupal 8 website
  • Navigate to Extend, search for Upgrade Status and install the module
  • If you navigate to Reports > Upgrade Status you can see what needs to be done before you can upgrade the core to Drupal 9
  • First check if there are modules currently installed that you don’t use and uninstall them
  • Back in the console use the following command to update all the modules:
    drush up
  • If you go back to the Upgrade Status overview you see some modules have not been updated. These modules need to be updated to another major version. For instance the Backup and Migrate module needs to be updated from 8.x-4.2 to 5.0.1. In order to do this you use the following command:
    composer require drupal/modulename:^2.0
    In the case of the Backup and Migrate module this would be:
    composer require drupal/backup_migrate:^5.0.0
  • Other modules need to be updated to a specific version. You can do this with the following Drush command:
    drush up modulename-8.x-2.0
    For example the Crop API module needs to be updated to version 8.x-2.1
    drush up crop-8.x-2.1
  • Next we want to make our theme compatible with Drupal 9. Go to the themes/theme_name directory on your local machine.
  • Open your theme_name.info.yml file
  • Add the following below core: 8.x
    core_version_requirement: ^8 || ^9
  • And save the file.
  • Note: In my Upgrade Status I kept getting the following error:
    Use of $config_directories in settings.php is deprecated. Use $settings['config_sync_directory'] instead.
    Even after I’ve adjusted this as suggested the error remained. This is likely a bug in the Upgrade Status module so I proceeded upgrading the core ignoring this error.
  • Now to upgrade the Drupal core. I’ve been searching on how to do this, but both the Drush and Composer routes weren’t working for me. So I resorted to the old school method of just copying files. 
  • Download the latest version of Drupal 9 and extract the files on your local machine.
  • In the extracted Drupal 9 folder remove the following folders:
    modules
    sites
    themes
  • In the root of your local Drupal 8 site remove all the files and these folders:
    core
    profiles
    vendor
  • Copy over all the files and folders from the Drupal 9 directory over to the directory of your local Drupal 8 site
  • Navigate to /update.php on your local Drupal 8 website
  • Fix any errors that might pop up and apply the database updates
  • If all went well your website should now be upgraded to Drupal 9
  • Go to your live Drupal 8 website and put it in maintenance mode by navigating to Configuration > Development > Maintenance mode
  • Open an FTP client and go to the Drupal 8 directory of your live site
  • Remove all files and folders
  • Upload all files and folders from your just upgraded local Drupal 9 site
  • Open Acquia Dev Desktop 2 and open the database manager by clicking on More
  • Select the correct database on the left and click on Export
  • Click on Start. This will initiate a download of your database in a .sql file
  • Go to your hosting panel of your live site and access the database manager (usually phpmyadmin)
  • Click on the database used for your live Drupal 8 website
  • Drop all tables
  • Import the .sql file you’ve exported
  • If all went well you can now visit your upgraded Drupal 9 website on your live location

As I said before, this might not be the correct way of upgrading a Drupal 8 to a Drupal 9 website, but for me it's the only thing that worked. Hopefully this will help you as well and if there is a flaw in my thinking please let me know by leaving a comment.

Also, don't forget to subscribe to my Drupal newsletter.

More Drupal tutorials

The content of this field is kept private and will not be shown publicly.

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Comments

This looks pretty correct to me with the constraints you had. The only difference for the sites I updated was I used composer for all the updates, not a mix of composer and drush. And rather than sync the db, I ran config export after getting the local version working, and deployed that and the new module versions/code, importing the configuration after I ran the db updates in production

Thanks for taking the time to write this up

Thanks for checking my process. I rather update everything with Composer as well, but got some weird errors so I had to resort to Drush.

Syncing the db does sound like the better option. I'll will try it this way for the next Drupal 8 website I have to upgrade.

does this upgrade method produce a usable composer.json that can then be used to update the site using composer?

This method does produce a composer.json file, but I'm not sure if it can be used to update the site. It does mention the drupal-core package. I'll wait for the next Drupal update and will try to update it with composer. I will post the outcome here.