Rebuild a Drupal 8 site

WARNING: Unixy skills required.

I was getting a PHP error after installing a brokeh module: Cannot instantiate interface Drupal\Core\Cache\CacheBackendInterface... Couldn’t create blocks, edit nodes, nothing!

Solution:

  • Grab Drush
  • Tell it to rebuild Drupal

Grab Drush

Drush is a command-line tool for doing Certain Things to Drupal. To install for a particular site, not system-wide:

  • Go to your Drupal site’s root directory
  • mkdir drush (makes a directory)
  • cd drush (descend into the directory)
  • Download the Drush PHAR file. PHAR is a PHPy archive format, like Zip.

wget http://files.drush.org/drush.phar

To run a Drush command: php drush.phar some-command

Rebuild Drupal 8 cache

Magic time!

php drush.phar cr

cr is short for cache-rebuild. Help says it will: “Rebuild a Drupal 8 site and clear all its caches.” No, I don’t know what that means. But it works!

From our sponsors: If you enjoyed this tip, play with your dog.