The drupal hosting system that we are currently using prevents us from making any changes to civicrm.settings.php which I find is sometimes necessary or at least the most sensible solution in certain situations. (One example is to set domain IDs when using Domain Access.) I believe the file is regenerated regularly so changes wouldn't last long anyway. I am hoping that someone who knows what they're doing can suggest an elegant way that I could put any code meant for civicrm.settings.php in another file elsewhere, preferably on the site level for multisite situations.


1 Answer 1


I'm assuming you're talking about DEFINE statements since you mention domain id? Are you able to edit drupal's settings.php? If so you can just put those DEFINEs in there since it loads first and most of the DEFINE settings in civicrm.settings.php check for if (defined(SETTING_NAME)).

If you can't edit drupal's settings.php, I haven't tested this but can you write a little drupal module that sets those defines, and in the system table set that module's weight to something lower than the weight for civicrm so that it runs first.

If you're talking about various $civicrm_setting['xxxxx'] entries, then again I haven't tested but the module method might also work but you would set the weight higher than civicrm's weight, so that it loads after.

  • Thanks! Can't edit settings.php but there is a local.settings.php available that can be made writable and that works fine for defining constants and setting any other CiviCRM variables.
    – Aiden
    Commented Mar 27, 2020 at 7:30
  • 3
    Note that there are still some pathways that don't use the settings.php file (e.g. the code that is executed to track civimail opens), so there may be some configuration changes that won't work in there. Most of the time settings.php is loaded before civicrm.settings.php, so the local.settings.php file is going to be the right answer.
    – Alan Dixon
    Commented Mar 31, 2020 at 20:04

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.