<
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:
Install Drush.
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;"
{cache_bootstrap}
and {registry}
tables:drush sqlq "TRUNCATE cache_bootstrap; TRUNCATE registry"
{registry}
table:drush sqlq 'INSERT INTO registry (name, type, filename) VALUES ("SelectQueryExtender", "class", "includes/database/select.inc"), ("DrupalDefaultEntityController", "class", "includes/entity.inc");'
drush eval "registry_update();"
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 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.
Let’s get you started!