Drupal7 – Where Can Modules Live?

Modules can live in many places. If you use Apple’s OSX it’s a lot like where Applications and Fonts can live in OSX, or how configuration can be per-user under Windows home user directories.

Modules can live at:

  • /profiles/PROFILENAME/modules/

  • /sites/default/modules/

  • /sites/all/modules/

  • /sites/SITENAME/modules/

core drupal modules are found in DRUPAL_INSTALL_DIRECTORY/modules.

Where a module lives deems how drupal sees it.

  • Modules in a profile directory can be seen by sites installed by that installation profile.

  • modules in /sites/default can only be seen by the default drupal site.

  • modules in /sites/all path can be seen by all drupal powered websites regardless how they were installed, or what subsite they are.

  • modules in /sites/SUBSITE/modules can only be seen by that subsite.

In general it is best practice to place the module folder where it is needed for its scope of use in your Drupal installation.

Additionally, it is a best-practice to place subfolders such as:

  • /sites/SUBSITE/modules/contrib

  • /sites/SUBSITE/modules/custom

to distinguish within a modules directory what is standard 3rd party contributed modules used for a site, and what is custom built drupal modules by your company in /custom.

Yes, there is documentation on this in your drupal installation folder at /sites/all/README.txt

Note: a lot of this changes slightly with drupal 8

Basically at some point in drupal development you want to organize your modules more and more, per site, per drupal installation. Many developers use these types of conventions. Drush Make (bundled into core Drush as of 5.x) allows specification of a subdirectory within /modules to place a module.

Looking for quality Drupal Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , | Posted under Drupal | RSS 2.0

Author Spotlight

David Gurba

I am a web programmer currently employed at UCSB. I have been developing web applications professionally for 8+ years now. For the last 5 years I’ve been actively developing websites primarily in PHP using Drupal. I have experience using LAMP and developing data driven websites for clients in aviation, higher education and e-commerce. If you’d like to contact me I can be reached at david.gurba@arvixe.com

Leave a Reply

Your email address will not be published. Required fields are marked *