Just in case - Drupal 8's /core/rebuild.php

Published April 27, 2016

Drupal 8 has lots of things that Drupal 7 doesn't have - a modern object-oriented foundation, the Twig templating system, and WYSIWYG out-of-the-box - just to name a few. There's also a good number of less flashy additions that are designed to improve the developer experience. One of these additions is the /core/rebuild.php file. 

While it is common knowledge that clearing rebuilding Drupal's caches is good practice during development, Drupal 8 brings a new tool to the table to get it done. Previous to Drupal 8, most developers utilized Drush to clear caches, some less-efficient folks cleared caches from the user interface (usually from the Admin Menu, but sometimes - gasp! - from the admin/config/development/performance page). 

Drupal 8 comes with a new /core/rebuild.php file that doesn't require the Drupal 8 site to be functioning (fatal errors, anyone?) nor does it require Drush or Drupal Console. Instead, as long as your site's configuration allows it, all you have to do is navigate to /core/rebuild.php in your browser. As Drupal's documentation states, this "Rebuilds all Drupal caches even when Drupal itself does not work."

How do you know if your site's configuration supports this functionality? Well, if you're working locally (and if you're developing, you should be working locally), then just make sure that $settings['rebuild_access'] = TRUE; in your settings.php (or, better yet, settings.local.php). The other method involves running the /core/scripts/rebuild_token_calculator.sh script from the commandline, and using the results as query parameters for /core/rebuild.php (see "Method II" on https://www.drupal.org/node/2153725).

Granted, most developers have Drush and/or Drupal Console installed everywhere they're working, but it's always good to have a backup method for rebuilding Drupal's caches - just in case.

Sign up to receive email notifications of whenever we publish a new blog post or quicktip!

Name
CAPTCHA