I was working to create skeletal extension module through civix but unfortunately I am getting this exception "Failed to locate CMS. Please call civix from somewhere under the CMS root."

  • The error message offers a suggested course of action -- i.e. make sure that the extension folder is located under the CMS root (Drupal/WordPress/Joomla/website root). Before calling civix, make sure to cd into that folder. If that doesn't work, then update the question to include details about your directory structure and environment. If you use symlinks, hardlinks, or other filesystem tricks, change the file structure to be simpler.
    – Tim Otten
    May 30, 2015 at 8:03

2 Answers 2


Maybe the standard wrong suggestion :-) but did you try the generate:module whilst in a subfolder of your website root?


The problem is resolved now, actually when I called civix from var/www/drupal I was getting this exception. Then after installing buildkit and setup of drupal-demo site, I again called civix but this time under the drupal-demo CMS root dir (viz. /opt/buildkit/build/dmaster/sites/all/modules). Now I am successfully able to generate a skeletal extension module.

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.