I'm encountering a really weird bug with Drupal. I'm running Debian's Drupal in a multisite configuration on the same host with both the dev and live websites. I know it's not ideal but this is a constraint I cannot avoid for a variety of reasons.

So I have my sites (e.g. dev.example.com and www.example.com) and I sync them with drush sql-sync. Right after doing so, I cannot access the synced website anymore and Apache throws the following errors:

PHP Fatal error:  Cannot redeclare ctools_content_process()
(previously declared in /etc/drupal/7/sites/www.example.com/modules/ctools/includes/content.inc:18)
in /etc/drupal/7/sites/dev.example.com/modules/ctools/includes/content.inc on line 84

To make my website work again, I have to manually do a find-replace in MySQL to change any instance of dev.example.com to www.example.com in tables field_data_body and field_revision_body.

I reckon the problem is linked to CTools (and hence to views), but I have no idea why. Have any of you ever encountered such a problem?

  • Seems you synced too much - information about module locations should NOT be synced. Is it a bug in drush, or something with your setup or the way you synced, I cannot tell. Try clearing all caches, and if that won't help restore {system} from backup. – Mołot Apr 11 '14 at 8:36

In Drupal 7; this could be caused by corruption in the code registry. The code registry

is an inventory of all classes and interfaces for all enabled modules and Drupal's core files. The registry stores the path to the file a given class or interface is defined in, and loads the file when necessary.

ref: Drupal Code Registry

The solution to this particular problem would be to force a rebuild of the registry; which you can do as per this post; Code Registry Rebuild.


Are you using Drupal 6? In Drupal 6, the full path to the sites folder is written into the database for a variety of purposes. Because of this, if you change the path to settings.php, you break Drupal. The usual solution to this problem is to put your settings.php file in sites/default instead of sites/www.example.com; however, it sounds like that is not an option in your instance.

If you are using Drupal 7, it could be that CTools has taken on the practice that was common in Drupal 6, but for the most part this has been left behind in Drupal 7.

In any event, it sounds like you have your workaround. Stream-editing an SQL dump is inelegant, but since "dev" and "www" are the same length, it would be possible for you to do this. (If the site names were different lengths, this would not work, because serialized strings contain length bytes, and the path to the sites folder probably appears in serialized strings.) I really wouldn't recommend it -- better to try to overcome some of the constraints you've mentioned -- but if you're really stuck, it beats not being able to make a dev site. I will also advise you to only sync from www.example.com to dev.example.com to avoid overwriting user content. Look into the features and ctools export bonus as possible alternate ways to move configuration from dev to live without using sql-sync.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.