This article explains how to update drupal 8 core minor updates. You can update Drupal from one 8.x.x version to any later 8.x.x version (For example, from 8.2.1 to 8.2.2, or from 8.3.5 to 8.4.0) in two ways -
First common steps and definitions for both ways
- Consider you are upgrading to Drupal 8 version x.y.z,
x is called the major version number,
y is known as the minor version number, and
z is known as the patch version number.
- Make a full backup of all files, directories, and your database(s) before starting an update.
- It is always better to update or upgrade a test copy of your site before applying it to live. Even minor updates can cause your site's behavior to change.
- With each new release of Drupal, release notes related to new version get published, which list outs and explain the changes made since the previous version and any special instructions needed to update or upgrade to the new version.
- You can find the release notes for your version at https://www.drupal.org/project/drupal/releases/8.x.x. Where 1st x = minor version and 2nd x = patch version.
Steps to update minor and patch versions of Drupal 8 manually
- Log in as admin or user with the permission "Administer software updates".
- Go to Administration > Configuration > Development > Maintenance mode and put the site into maintenance mode by enabling "Put site into maintenance mode" checkbox.
- Remove the 'core' and 'vendor' directories. (Do not override these directories with new directories as it will lead to WSOD and site will break)
Keep modules, themes, profiles, sites directories.
Also remove all of the files in the top-level directory, except any that you added manually (like Google, Bing verification files, error log file).
- Download the latest Drupal 8.x.x release from Drupal website to a directory outside of your web root. Extract the archive and copy the files into your Drupal directory.
If you made changes in files like .htaccess, composer.json, or robots.txt then you have to re-apply them from your backup, after the new files are in place.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:
- find 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 must have to copy lines giving the database information, and you will also want to copy in any other customizations you have added.
- Run update.php by navigating to http://yourdrupalsitename/update.php and follow the process. This will update the core database tables.
If you are unable to access update.php do the following:
- Open settings.php in editor.
- Find the line:
$settings['update_free_access'] = FALSE;
- Change it to:
$settings['update_free_access'] = TRUE;
- Save settings.php. Try again to run update.php.
- Once the update is done, $settings['update_free_access'] must be reverted to FALSE.
- Go to Administration > Reports > Status report. Verify that everything is working as expected.
- Go to Administration > Configuration > Development > Maintenance mode. Disable the "Put site into maintenance mode" checkbox and save the configuration.
Steps to update minor and patch versions of Drupal 8 through drush
Drush make backup the Drupal core installation for you, but you might want to backup the sites directory just in case something goes wrong. You can use Drush to back-up the database too.
- Put your site in maintenance mode.
drush cr used to rebuilt cache.
drush sset system.maintenance_mode 1 drush cr
- Run update command in drush to start update.
When you enter this command confirmation question will be asked. type y and enter
Drush will also update your database if necessary and make backup in your home directory. Check if there are any errors, warnings or notices. If yes then note it down and try to solve errors manually.
- Check that everything works
Check site and test everything! If you had modified robots.txt or .htaccess, make sure you should reapply them. (Sometimes you can just copy the old files back.) If you used a custom installation profile, you might have to copy that back too. If the default.settings.php file has changed, make sure settings.php file has the latest and correct information.
- Put your site online again
drush sset system.maintenance_mode 0 drush cr
- Some other options
drush pm-updateis the same as running
drush pm-updatecodeand then
drush updatedbso you can optionally run the latter two commands to break up the process.
drush pm-updatecodehas a number of options you can use with
drush pm-update, including