Clear the cache in Drupal 8 bypassing the admin panel

Not a typical situation - after the edits on the site, inoperable code remained in the template file, after which the cache was cleared from the admin panel. After that, of course, we get a non-working site that simply displays our faulty code in text. Attempts to log in do not bring any results.

There are at least three options

  • Manually clear cache tables in the database
  • Clean up by adding a variable to settings.php
  • Run cleanup via drush

The first option takes place, if the site is generally not a pity, because any dependencies and compatibility can fly off, and you will have to poke around in the code for a long time.

Personally, I am not friends with drush, but it seems to solve the problem quickly by running the command

drush cache:rebuild

Therefore, the second option is more preferable for me. To do this, in the settings.php settings file, insert the line anywhere

$settings[\'rebuild_access\'] = TRUE;

After that, go to the address

https://%yourdomain%/core/rebuild.php

The site will start loading for a rather long time, it may take a minute, if not two, but after that it should start normally, as after a normal cache clearing.

After that, do not forget to go back to the settings and delete, or comment out our added line.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
The comment language code.