As the number of modules used increases, I try to reorganize modules in /***/sites/all into

  • sites/all/modules/contrib
  • sites/all/modules/custom
  • sites/all/modules/dev

subfolders as it is described here (1) and now I use a solution similar to what was answered here (2)

Question: Is possible to use path variable or another solution instead of creating symlinks for each contrib module?

I don't want to create so many symbolic links for each of contrib modules separately.

How to explain to Drupal the sites/all/modules structure the way I don't get bootstrap.inc errors such as:

Error: require_once(): Failed opening required
(include_path='.:/usr/local/php5/lib/php') in
/***/includes/bootstrap.inc, line 2935

3 Answers 3


You just move your modules into relevant subdirectories inside sites/all/modules, clear caches and everything should work fine as before, Drupal will find them there without any problems. You don't have to create any symbolic links to make it work.

  • 3
    This is correct in general. However, there are some issues, especially with the class registry, which break this. This is for example because some classes are included before you have a chance to clear the caches. A possible way to fix this is using drupal.org/project/registry_rebuild
    – Berdir
    Commented Sep 18, 2011 at 15:03
  • Thanks Berdir, haven't been in this situation yet. Even then I guess you could just empty cache tables directly in database, no need to use additional modules? Commented Sep 18, 2011 at 15:39
  • 2
    No, the registry is not a cache, it resides in it's own database tables. It can't be cleared because Drupal itself requires this registry or it won't work at all. Obviously, this is a crappy situation and will hopefully be taken care off in D8.
    – Berdir
    Commented Sep 18, 2011 at 16:07
  • Thanks Maciej, Thanks Berdir, I think you were both right. This time to solve this I created symbolic links to modules that were obviously included in boot sequence before I could clear the cache, then I cleared the cache and I could remove symbolic links. I will use Registry Rebuild next time.
    – LLub
    Commented Sep 18, 2011 at 18:36

The Registry Rebuild module really is the answer. I struggled to solve this problem for hours, then this module fixed it completely, and with elegance!

  • Thanks, I also use registry rebuild in many situations it is helpful but in this case Maciej was right for me it worked directly without need to set the structure up any special way.
    – LLub
    Commented Feb 9, 2012 at 18:53
  • Yup, I've run into cases where it's impossible to run any drush commands and clearing cache does nothing. Registry rebuild worked great for me! Commented Jul 30, 2013 at 2:30
  • hmm... tried this, and drush rr kept failing because the modules that I moved into sites/all/modules/contrib were no longer directly under sites/all/modules/. =/ Commented Feb 24, 2015 at 21:43

After reorganizing module to contrib, custom, features, patched, you need to rebuild Drupal registry. As @kiamlaluno said for this you need Registry Rebuild module/drush script. For me, with multiple websites, it also required reloading/restarting Apache to get rid of errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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