Configuring dev-site specific settings is easy using the $conf array in settings.php

Sometimes I need to also disable (securepages) or enable (devel) certain modules on a dev site, but I don't know of an analogous method for doing this via settings.php

One hack which seems tempting is to define, say, menu_init() in settings.php (*gasp), and make that function check that the required modules are enabled using module_exists().

[* Yes, all manner of things might asplode if menu.module defined that function. OMG,ETC.]

So I'm wondering if people have done similar things to make sure their dev site is correctly configured, and if so, what. Is this the Poor Dev's Pantheon?

  • Related, but not the same question: drupal.stackexchange.com/questions/2387/… Commented Aug 1, 2011 at 7:29
  • 2
    Current approach is to make a little restore.sh which installs the DB, makes any DB-level changes required, and then calls drush to enable/disable the modules required. Commented Aug 1, 2011 at 7:30
  • We use a custom drush command for this.
    – Justin
    Commented May 28, 2014 at 1:31
  • Tonight I noticed Environment Modules which appears to be another (see answer below) solution to part of this. Not a recommendation, just noticed it exists. Commented Jul 19, 2014 at 8:48

1 Answer 1


(It was me who wrote the instructions for the hook_init() hack at http://drupal.org/node/206368.)

Recent module-level ways of supporting this workflow are underway at the Environment module, and the Production check & Production monitor.

I feel they will rapidly become too bulky: Do you really need to enable a module to ensure another module is turned off? But, at least they may be able to provide a few conventions for us, like putting the list in local.settings.php or equivalent. I hide per-instance configs in in my site_aliases.drushrc, which is my alternative to local.settings.php

I'm not going for another script you have to call, unless it's part of a fully automated workflow.

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.