Menu icon
RedCrackle
Menu icon
Services
01Design Transformation
About UsCase StudiesBlogContact Us

<

Blog post

How To Perform A Registry Rebuild Manually In Drupal?

Neerav Mehta

Founder & CEO

There are several cases where you will have to rebuild the registry in Drupal. I have encountered one such case in the form of this error:

Fatal error: require_once(): Failed opening required '/files/mailsystem/HTMLMailSystem__SmtpMailSystem.mail.inc'

This error seems to be occurring in many scenarios.

Ideally, a Registry Rebuild would take care of the issue. But it didn’t help in my case.

I even tried to run a drush rr command but it didn’t work.

I began to look for other solutions. This is when I decided to rebuild the registry manually.

The following steps are involved in rebuilding the registry manually in Drupal:

  1. Install Drush.

  2. Take a backup of your database. Or take backups of {registry} and {system} tables. Run the following code using Drush to back up the tables:

drush sqlq "CREATE TABLE registry_bak LIKE registry; INSERT INTO registry_bak SELECT * FROM registry;"
drush sqlq "CREATE TABLE system_bak LIKE system; INSERT INTO system_bak SELECT * FROM system;"
  1. Truncate {cache_bootstrap} and {registry} tables:

drush sqlq "TRUNCATE cache_bootstrap; TRUNCATE registry"
  1. Insert the Controller name, type and filename in the {registry} table:

drush sqlq 'INSERT INTO registry (name, type, filename) VALUES ("SelectQueryExtender", "class", "includes/database/select.inc"), ("DrupalDefaultEntityController", "class", "includes/entity.inc");'
  1. Update the registry values:

drush eval "registry_update();"
  1. Clear the Caches:

drush -y cc all

The above steps will help you rebuild the registry. If you are not using Drush, you can run these commands via SQL with your respective database.

After following the above steps, you may still get an error such as the one below:

Fatal error: Class 'Entity' not found in rules.module on line

You will have to run the following line command to learn where the entity class is located:

$ grep -Rwl "^class Entity"

It gives you the following result:

./sites/all/modules/entity/includes/entity.inc 

Then run the following line:

$ drush sqlq 'INSERT INTO registry (name, type, filename) VALUES ("Entity", "class", "sites/all/modules/entity/includes/entity.inc");'

And clear the caches again:

drush -y cc all

You have now successfully performed a Registry Rebuild manually in Drupal.

Neerav Mehta

Neerav Mehta

Founder & CEO

Neerav Mehta is the Founder & CEO of Red Crackle. With sterling qualities, Neerav’s technological acumen is firing a generation of progressive companies on the digital path. With an undergraduate degree in Electrical Engineering from India's most prestigious institution IIT Bombay and having spent seven years developing and contributing to the launch of AMD's innovative line of computer products, Neerav founded Red Crackle where he is lauded for his dynamic and innovative genius.

View all posts

>

Read Next

10 Tips For Entrepreneurs In 2015

10 Tips For Entrepreneurs In 2015

Learn more

10 Ways To Increase Productivity At Work

10 Ways To Increase Productivity At Work

Learn more

30 best WordPress widgets for your site

30 best WordPress widgets for your site

Learn more

Let’s get you started!

Contact Us

>

RedCrackle

Explore

About Us

Services

Contact Us

Our address

5346 Gerine Blossom Dr,

San Jose, CA 95123

USA

Socials

Twitter
LinkedIn

© 2023 RedCrackle. All rights reserved.