Drupal registry rebuild as a sure way to fix errors

Apr 27, 2017
Drupal registry rebuild as a sure way to fix errors

As a truly powerful CMF, Drupal offers you numerous tools to polish your website to perfection — enhance its security, harness the power of content marketing, improve its performance, and so on and so forth. It seems like where is perfection, there is no place for an error. However, errors may sometimes occur on Drupal websites due to some wrong action being taken. Fortunately, Drupal offers reliable ways to fix them! So today, we’ll consider an example of this — Drupal registry errors, and a great way to recover from them by using Drupal registry rebuild. Let’s get some more details about it.

A glimpse at Drupal registry errors

In Drupal, there is a registry that keeps track of all the files, modules, themes, and so on. It knows which PHP classes are sourced from which files. Sometimes, the registry is unable to find some of them. They may have been “lost,” for example, in the process of a manual website migration, when you may have removed a module or forgotten to include one. In this case, the registry starts to “worry” and malfunctions, which leads to fatal errors.

Cache clearing (for example, with drush cc all), which can be a real panacea in many situations, may be helpless here since running Drupal bootstrap is impossible.

It can be a really nasty shock to see an error like the following:

PHP Fatal error:  Class 'EntityAPIControllerExportable' not found in ...

sites/all/modules/rules/includes/rules.core.inc on line 11

The solution: perform your Drupal registry rebuild

The answer is: keep calm and rebuild your registry! You will need some building tools for getting all bricks in their proper places so your Drupal tower is solid again.

Luckily these building tools are easily available. One of them is the Registry Rebuild Drush plugin. It’s quite easy to use, and one of its benefits is that you do not even need to access your site — just rely on Drush command-line interface.

Steps for using the Registry Rebuild plugin with Drush:

  • Install the Registry Rebuild plugin to your Drush folder using this command: drush dl registry_rebuild
  • Back up your website’s database for safety reasons
  • Clear the Drush internal cache using this command: drush cc drush
  • Begin your registry rebuild process. You have two main options: 1) from your site’s folder (drush registry-rebuild or drush rr for short) or 2) via alias (drush @site-alias rr)

Congrats, you are done! Your Drupal registry now knows the proper location of all files, so the issue is fixed. If this does not work, you could try to get back the missing modules or files. Running the registry rebuild plugin manually using the php file could also be a solution.

We hope you have the smoothest Drupal registry rebuild process possible! However, if you need a hand, or if you do not know how to identify or fix a certain error or malfunction, you can rely on our Drudesk support team. We can rebuild anything — from your registry to your whole website, if needed. Rebuilding, repairing, redesigning, putting fresh paint on the walls, or even building from the foundation — anything can be done to make you truly enjoy your website. And with no errors!

 Get new blog posts by email