How to Rebuild Your Database Registry

Apparently I am lucky, having gone through years of Drupal development without encountering a corrupted database registry. If you encounter a “Failed opening required … “ error then it is possible you've run into the same issue. (click here if your site is on Drupal 8).

PHP Fatal error: Class 'EntityAPIControllerExportable' not found in ...sites/all/modules/rules/includes/rules.core.inc on line 11

Thankfully the solution is quite easy. It is possible that the Drupal database registry can get corrupted, but all it needs is a rebuild. If you have Drush installed then you can run the following (after backing up your database for safety):

If Drush didn't rebuild the registry properly:

You can run the registry rebuild manually. Download the registry rebuild and put it in your sites module folder: download. If your module folder is not set to the default sites/all/modules, or sites/your-multisite-folder/modules, then you will need to edit the registry_rebuild.php file and update the $module_dir variable.

Once you have the module installed you can run the registry rebuild from the console with

Drupal 8 Instructions:

You're in luck! Or out of luck if you have a similar problem and thought you'd find a solution for D8 here (sorry). Drupal 8 has moved nearly all configuration to file storage.

Instead of database registry checks you need to use a versioning sytem. This is not one of those "nice to have" options which you'll install when you have the free time, version control serves as a backup system for your site's code. It is worth the effort, and will increase efficiency while minimizing time to fix incorrect or conflicting code deployments. Check here for a list of options.

Most Drupal sytems use Git, but there are plenty of options to choose from.