Updating Drupal 8 Core: Ultimate guide in simple steps

Updating a Drupal module is pretty easy, but the core cannot currently be updated through the GUI. Debate on ease of use vs flexibility seems to be keeping a quick method of updating the core out of our reach.

The objective of this guide is to:

  • Explain what the update process is, and is not
  • Highlight the best practices for updating
  • Take you through updating step-by-step
  • Troubleshoot update problems

 

Explain what the update process is, and is not

Updating Drupal 8 core is the process where the latest bug fixes and improvements to Drupal are added to your Drupal installation. Updates come out frequently in order to bring feature improvements and to ensure the security of the system.

A core update is different to a module update as it deals with the basic Drupal system, but it can include the 'Core Modules' which are those which come as standard with Drupal such as Views.

An update is also different to an upgrade

Drupal releases have a number system, at time of writing we are on Drupal 8.7.10 as the latest stable release. The first of those numbers is 8, this relates to the Core Version, the other numbers relate to minor improvements within that version. Moving from Drupal 7 to Drupal 8 was an upgrade, however moving from Drupal 8.7.9 to Drupal 8.7.10 was an update.

Upgrading from one major release to another is a big deal as contributed modules and programming language versions that you use may not be supported by the new release.

Updating to a new minor release is usually a simpler affair, but can still cause issues.

 

Highlight the best practices for updating

Updating the core from one minor release to another is as simple as deleting a few files and replacing them with new ones. This being said, we must show caution because:

  • Some modules may not work with the new release
  • Some modules may work but need to be re-configured
  • Any changes to the database or file system can break your installation
  • Your server may not be ready for the new release if requirements have changed such as PHP versions
  • Experimental modules you currently use may be removed in the new release
  • .htaccess, robots.txt and composer.json files will be replaced and you may have changed these files

Before updating - A checklist

  1. Read the release notes for the core update, they are linked to from the download page and will cover known issues with an update
  2. Check which modules you have and if there are any which can be removed, making the update process easier on your system, after the installation you will be told by the system if there are conflicts and you can sort them out
  3. Check in the release notes for changes in language versions, make sure your server is using the best PHP version for your needs
  4. Review your .htaccess and robots.txt files to see if you have customised them, make a note of the changes so they can be reapplied to the new files if needs be
  5. See if you are making use of any experimental modules and if these will be removed in the new release, if yes, then can you find a contributed module or workaround for your needs?
  6. Backup your files and database, then test your backup to make sure it is functional, the best way to do this is use it to create a duplicate of your site, this is useful because you can update the backup version and see if it works while leaving your actual website up and running

 

Take you through updating step-by-step

If you have gone through the above check list then you are all set to update. I do recommend updating on the test version of your site I mentioned above so it if breaks or takes you a long time to get right, it will not impact on your production site. As a minimum, remember to back up, every developer has had a site crash at least once and you do not want to lose hours or more of hard work.

Below is the procedure recommended by Drupal, with additions for clarity:

 

  1. Put site into maintenance mode

  2. Remove the 'core' and 'vendor' directories from the top level of your site, also remove the other files in that directory (but not the other folders) You can leave any folders you added yourself untouched

  3. If you altered files like .htaccess, composer.json, or robots.txt, back them up now – you will need to re-apply them from your backup, after the installation

  4. Sometimes an update includes changes to default.settings.php (this will be noted in the release notes). If that's the case, follow these steps:

    • Locate your settings.php file in the /sites/* directory. (Typically sites/default.)

    • Make a backup copy of your settings.php file, with a different file name.

    • Make a copy of the new default.settings.php file, and name the copy settings.php (overwriting your previous settings.php file).

    • Copy the custom and site-specific entries from the backup you made into the new settings.php file. You will definitely need the lines giving the database information, and you will also want to copy in any other customizations you have added.

  5. You can find the release notes for your version at https://www.drupal.org/project/drupal. At bottom of the project page under "Downloads" use the link for your version of Drupal to view the release notes. If your version is not listed, use the 'View all releases' link. From this page you can scroll down or use the filter to find your version and its release notes.

  6. Download the latest Drupal 8.x.x release and copy over the files you deleted from the old installation

  7. Re-apply any modifications to files such as .htaccess, composer.json, or robots.txt.

  8. Run update.php by visiting http://www.example.com/update.php (replace www.example.com with your domain name). This will update the core database tables.

  9. If you are not logged in as a user with the "Administer Software Updates" permission, or the site maintenance account (as created during installation) you will be unable to access update.php – you can bypass this restriction as follows:

    • Open settings.php with a text editor.

    • Find the following line and change the value to TRUE:

    • $settings['update_free_access'] = FALSE;

    • Visit the /update.php page again.

    • Once complete, you must change the setting back to FALSE for security reasons.

 

Troubleshoot update problems

CSS or navigation is broken

If your update seems to work ok, but your site looks different or not every page is accessible, you may be having an issue related to your servers virtual directories.

  • Go to your site's .htaccess file mentioned earlier (top level directory, it may be hidden so make sure you can see hidden files) and find the line RewriteBase /rewritebase screenshot

     

  • This line should have a # by it, this means it will not be active, delete the # to turn on the code
  • Save the .htaccess file and try your site again

Some of your pages say 'Page not found'

Some changes can mess with the cache, clear the cache then try your site again

Tags

Drupal
8
Updating
Configuration
Guide

Add new comment

CAPTCHA
Answer the below question to help us fight spam

What is the opposite of light?