Is it possible to use PHP to define the CIVICRM_LOGGING_DSN setting located in civicrm.settings.php? We are using Drupal.

I have successfully used the following to change some settings before:

Civi::settings()->set('customPHPPathDir', "$root/CustomPHP/");

Thanks for any help!


It's not a setting you can set with Civi::settings. You can set it with a define() anywhere outside of civicrm.settings.php, but it would need to run that section in your file before running the code where it gets used, so somewhere pretty early in a page run. It always falls back to CIVICRM_DSN if CIVICRM_LOGGING_DSN is not set, if your setting runs too late.

  • Just to make sure I understand. Would it need to get called every single time before civicrm.settings.php (before a Civi page is even starting to load)? If that is the case, maybe a drupal hook would work? – Sleewok Feb 18 '19 at 21:00
  • 1
    Yes that might work if the drupal module has a higher weight than the civicrm module (e.g. the weight field in the drupal system table in drupal 7). – Demerit Feb 18 '19 at 21:03
  • 1
    I mean lower weight, oops. See drupal.org/docs/7/creating-custom-modules/howtos/… – Demerit Feb 18 '19 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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