I need to override configuration variables declared in the settings.php. How this can be possible? Any help me on?

Note: I am trying to override a custom configuration variable, not any default one.

  • 1
    Refer coderwall.com/p/tdoztq Jun 9, 2014 at 11:39
  • 2
    @ Krishna Mohan Thanks. But using variable_set(), it will override the configuration variable to the function in which it is used. If we try get the value of config variable in another function it will displays it again from settings.php. I need to override this in such a way that, wherever we try to fetch that variable the value will be the new one.
    – Aswini K
    Jun 9, 2014 at 11:51
  • 1
    @akm That's not possible without rewriting variable_get
    – Clive
    Jun 9, 2014 at 12:00
  • 1
    @Clive Thanks. So there is no possible way to override it without editing the settings.php?
    – Aswini K
    Jun 9, 2014 at 12:02
  • 3
    Conf values in settings.php always "win"...they're supposed to be unconditional overrides, stuff that the programmer/site builder is saying to Drupal "don't change these, I need them to be exactly this for my site to work". So to override a var set in settings.php, you need to change it in settings.php (or change the way variable_get works)
    – Clive
    Jun 9, 2014 at 12:09

1 Answer 1


You can't overwrite the variables in settings.php.

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.