I'm working on an extension and I need to include a PHP file that is in the civicrm module root dir. Is there a way to get this directory through PHP? I need it to work for all CMS, not just Drupal.


1 Answer 1


I found the answer in the docs here: https://docs.civicrm.org/dev/en/latest/framework/filesystem/#tip-programmatic-lookup_1

You can use the following:



global $civicrm_root;

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.