Update Drupal core from 8.7.0 to 8.9.3 with Composer
- Abhinesh Dhiman
- Aug 18, 2020
- 1 min read
Updating from one version to another is sometimes difficult and hard to do it is always recommended to update your site with the composer, So that all the core dependencies are met.
This new version of Drupal has many improvements, Below are the steps to get started :
Step 1: The first change is with the composer template to the new official template.
Step 2: Update the pathauto module to 1.6 or greater.
composer require drupal/pathauto:^1.6
Step 3: Backup your site and database.
Step 4: Remove or replace old dev packages.
composer remove --dev webflo/drupal-core-require-dev
* If you need developer tools then install them.
composer require --dev drupal/core-dev
Step 5: Update conflicting dependencies.
a. Require new Drupal core and dependencies
composer require --update-with-dependencies \
drupal/core:^8.9.3 \
symfony/finder:^3.4 \
symfony/filesystem:^3.4
b. Require new core-dev package and dependencies
* optional if dev is required.
composer require --dev --update-with-dependencies \
drupal/core-dev:^8.9.3 \
symfony/debug:^3.4
c. Remove temporary dependencies
composer remove -n \
symfony/finder \
symfony/filesystem \
symfony/debug
Step 6: Update database schema and config.
drush updb drush cr drush config-export
Step 7: Change in settings.php file.
change from:
$config_directories['sync'] = 'foo/bar';
to
$settings['config_sync_directory'] = 'foo/bar';
Now your site is updated from 8.7.0 to 8.9.3 with Composer.
Bonus :

Errors :
1. Fatal error: require(): Failed opening required '/var/www/html/vendor/composer/../phpunit/phpunit/src/Framework/TestCase.php' (include_path='/var/www/html/vendor/pear/archive_tar:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/pear_exception:.:/usr/local/lib/php') in /var/www/html/vendor/symfony/class-loader/ApcClassLoader.php on line 112
Solution: Restart PHP.
2. New 'core_version_requirement' key in info.yml files for modules, themes and profiles allows Composer semantic version constraints including specifying multiple major versions of core.
Solution: Comment the line looking similar in .info.yml.
core_version_requirement: ^8 || ^9
Comments