Answers.Body: <p>I had this same problem today.  While this may be too late for you, what I found was that somehow, the git repo in <code>&lt;webroot&gt;/sites/all/modules/civicrm/drupal</code> was set to the <code>master</code> branch and not the <code>7.x-master</code> branch.  Once I checked out <code>7.x-master</code> and did a <code>git pull</code> my problem resolved.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-30T03:32:29.637Z
Answers.Text: I totally forgot about this, but finding it saved my butt today.  Sorry I can't give you an upvote, 2019 Jon.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-10T22:10:05.987Z
Answers.LastActivityDate: 2019-04-10T22:10:05.987Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I'm trying to generate DAO and SQL files,
  when I run "php ./GenCode.php" in my xml path, I get this error in my console.</p>
  
  <pre><code>$ php ./GenCode.php
  
  civicrm_domain.version := 5.1.alpha1
  
  Parsing schema description schema/Schema.xml
  Extracting database information
  Extracting table information
  
  Fatal error: Uncaught exception 'Exception' with message 'Failed to locate template for civicrm.config.php' in 
  C:\wamp64\www\drupal\modules\civicrm\CRM\Core\CodeGen\Config.php:35
  </code></pre>
  
  <p>Stack trace:</p>
  
  <pre><code>#0 C:\wamp64\www\drupal\modules\civicrm\CRM\Core\CodeGen\Config.php(10): CRM_Core_CodeGen_Config-&gt;setupCms()
  #1 C:\wamp64\www\drupal\modules\civicrm\CRM\Core\CodeGen\Main.php(115): CRM_Core_CodeGen_Config-&gt;run()
  #2 C:\wamp64\www\drupal\modules\civicrm\CRM\Core\CodeGen\Main.php(100): CRM_Core_CodeGen_Main-&gt;runAllTasks()
  #3 C:\wamp64\www\drupal\modules\civicrm\extern\membership\xml\GenCode.php(39): CRM_Core_CodeGen_Main-&gt;main()
  #4 {main}
  </code></pre>
  
  <p>thrown in C:\wamp64\www\drupal\modules\civicrm\CRM\Core\CodeGen\Config.php on line 35</p>
  
  <p>when I look to the config.php file, it seems correct</p>
  
  <pre><code>elseif ($this-&gt;config-&gt;cms !== 'joomla') {
    $configTemplate = $this-&gt;findConfigTemplate($this-&gt;config-&gt;cms);
    if ($configTemplate) {
      echo "Generating civicrm.config.php\n";
      copy($configTemplate, '../civicrm.config.php');
    }
    else {
      throw new Exception("Failed to locate template for civicrm.config.php");
    }
  }
  </code></pre>
  
  <p>but it gives the same error, can you help me please? Thanks
  Fidi</p>
  
Tags: <drupal>
Title: Failed to locate template for civicrm.config.php
ThreadText: # Failed to locate template for civicrm.config.php
  
  (Asked by: username_0 on 2018-03-26)
  
  I'm trying to generate DAO and SQL files,
  when I run "php ./GenCode.php" in my xml path, I get this error in my console.
  
  ```
  $ php ./GenCode.php
  
  civicrm_domain.version := 5.1.alpha1
  
  Parsing schema description schema/Schema.xml
  Extracting database information
  Extracting table information
  
  Fatal error: Uncaught exception 'Exception' with message 'Failed to locate template for civicrm.config.php' in 
  C:\wamp64\www\drupal\modules\civicrm\CRM\Core\CodeGen\Config.php:35
  
  ```
  
  Stack trace:
  
  ```
  #0 C:\wamp64\www\drupal\modules\civicrm\CRM\Core\CodeGen\Config.php(10): CRM_Core_CodeGen_Config->setupCms()
  #1 C:\wamp64\www\drupal\modules\civicrm\CRM\Core\CodeGen\Main.php(115): CRM_Core_CodeGen_Config->run()
  #2 C:\wamp64\www\drupal\modules\civicrm\CRM\Core\CodeGen\Main.php(100): CRM_Core_CodeGen_Main->runAllTasks()
  #3 C:\wamp64\www\drupal\modules\civicrm\extern\membership\xml\GenCode.php(39): CRM_Core_CodeGen_Main->main()
  #4 {main}
  
  ```
  
  thrown in C:\wamp64\www\drupal\modules\civicrm\CRM\Core\CodeGen\Config.php on line 35
  
  when I look to the config.php file, it seems correct
  
  ```
  elseif ($this->config->cms !== 'joomla') {
    $configTemplate = $this->findConfigTemplate($this->config->cms);
    if ($configTemplate) {
      echo "Generating civicrm.config.php\n";
      copy($configTemplate, '../civicrm.config.php');
    }
    else {
      throw new Exception("Failed to locate template for civicrm.config.php");
    }
  }
  
  ```
  
  but it gives the same error, can you help me please? Thanks
  Fidi
  
  **Tags:** drupal
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-04-10. Score: 1
  
  I had this same problem today. While this may be too late for you, what I found was that somehow, the git repo in `<webroot>/sites/all/modules/civicrm/drupal` was set to the `master` branch and not the `7.x-master` branch. Once I checked out `7.x-master` and did a `git pull` my problem resolved.
  
  > **Comments:**
  > **username_1**: I totally forgot about this, but finding it saved my butt today.  Sorry I can't give you an upvote, 2019 Jon.  
  
  ---
  
  