Answers.Body: <p>As Drupal bootstraps, if it cannot find a database configuration it will attempt to do a URL redirect to the install page. Obviously this isn't helpful in a script where drupal will just quietly terminate.</p>
  
  <p>Because CiviCRM and Drupal use different logic to identify your <code>civicrm.settings.php</code> and <code>settings.php</code>  it is possible that the bootstrapping maybe attempting to look in different places.</p>
  
  <p>You can verify that both these files are loading during the bootstrap by inserting the magic line at the top and tail of each file:</p>
  
  <pre><code>    echo 'got here! #'.__LINE__.' '. __FILE__."\n";
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-31T23:08:09.933Z
Answers.LastActivityDate: 2016-12-31T23:08:09.933Z
Answers.UserDisplayName: ErichBSchulz
Answers.Body: <p>I would try</p>
  
  <pre><code>civix civicrm:ping -v
  </code></pre>
  
  <p>or even:</p>
  
  <pre><code>civix civicrm:ping -vvv
  </code></pre>
  
  <p>as the first thing as that could show something useful in the future.</p>
  
  <p>civix will fail silently if your civicrm.settings.php file:</p>
  
  <ul>
  <li>is turning down phps error reporting and it hits an error</li>
  <li>contains a <code>die</code> or <code>exit</code> command</li>
  </ul>
  
  <p>Eventually I figured out the problem as here:</p>
  
  <p><code>
  // civicrm.settings.php
  // set up php to show errors:
  if (isset($_SERVER['HTTP_HOST']) &amp;&amp; strstr($_SERVER['HTTP_HOST'], 'dev')) {
    error_reporting(E_ALL | E_STRICT);
    ini_set('display_errors', TRUE);
    ini_set('display_startup_errors', TRUE);
  }
  else {
    error_reporting(0); // &lt;&lt;&lt; this is bad if you cant find your problem!!
  }
  </code></p>
  
  <p>Inserting this in the else section confirmed that <code>$_SERVER['HTTP_HOST']</code> was undefined:</p>
  
  <p><code>
  echo '$_SERVER: '.json_encode($_SERVER,JSON_PRETTY_PRINT)."\n";
  </code>   </p>
  
  <p>So I was able to correct this just by setting up a mock value in bash to fix my civicrm.settings.php logic, and also to allow Drupal to find the right <code>sites/XXX/settings.php</code> file:</p>
  
  <pre><code>declare -x HTTP_HOST=contact-qld-dev1.myorg.example.com
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-08T15:41:13.307Z
Answers.Text: It helped us too, with multi-site environnement, we needed to set CIVICRM_SETTINGS and HTTP_HOST. Thanks !
Answers.UserDisplayName: veroniqueg
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-24T14:11:21.223Z
Answers.LastActivityDate: 2016-12-31T23:19:18.600Z
Answers.LastEditDate: 2016-12-31T23:19:18.600Z
Answers.UserDisplayName: ErichBSchulz
Answers.Body: <p>The other issue to be aware of is that <code>cv</code>, <code>civix</code> and other scripts bootstrap your CMS (eg Drupal) <strong>after</strong> it boots CiviCRM.</p>
  
  <p>So this means that your <code>civicrm.settings.php</code> file should not depend on settings set in you <code>settings.php</code> file.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-31T22:09:06.207Z
Answers.LastActivityDate: 2016-12-31T22:09:06.207Z
Answers.UserDisplayName: ErichBSchulz
Body: <p>I am running CiviCRM on Mac OSX 10.11.3, using the latest Bitnami CiviCRM/Drupal stack (bitnami-civicrm-4.6.11-0-osx-x86_64). 
  I have civix-15.04.1 installed as instructed (under $HOME/civix), and have it added to the path. Likewise I have updated the PATH to use the version of PHP provided by the stack.</p>
  
  <p>While I can use civix successfully to run commands like:</p>
  
  <p><code>$ civix generate:module</code></p>
  
  <p>when I try and run the following command (as a pre-req to generating custom-xml):</p>
  
  <p><code>$ civix civicrm:ping</code></p>
  
  <p>I get no output whatsoever (ie silent failure).</p>
  
  <p>I am running the command from within the web root.</p>
  
  <p>Anyone experienced this before? Any pointers greatly appreciated.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-24T14:10:00.650Z
Comments.Text: great question. I am getting same behaviour.
Comments.UserDisplayName: ErichBSchulz
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-31T23:13:05.540Z
Comments.Text: note that this also applies to the `cv` tool
Comments.UserDisplayName: ErichBSchulz
Tags: <extension><developer><php><civicrm.settings.php><civix>
Title: civix civicrm:ping not printing any output
ThreadText: # civix civicrm:ping not printing any output
  
  (Asked by: username_0 on 2016-01-24)
  
  I am running CiviCRM on Mac OSX 10.11.3, using the latest Bitnami CiviCRM/Drupal stack (bitnami-civicrm-4.6.11-0-osx-x86\_64).
  I have civix-15.04.1 installed as instructed (under $HOME/civix), and have it added to the path. Likewise I have updated the PATH to use the version of PHP provided by the stack.
  
  While I can use civix successfully to run commands like:
  
  `$ civix generate:module`
  
  when I try and run the following command (as a pre-req to generating custom-xml):
  
  `$ civix civicrm:ping`
  
  I get no output whatsoever (ie silent failure).
  
  I am running the command from within the web root.
  
  Anyone experienced this before? Any pointers greatly appreciated.
  
  **Tags:** extension, developer, php, civicrm.settings.php, civix
  
  > **Comments:**
  > **username_1**: great question. I am getting same behaviour.  
  > **username_1**: note that this also applies to the `cv` tool  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2016-12-31. Score: 1
  
  As Drupal bootstraps, if it cannot find a database configuration it will attempt to do a URL redirect to the install page. Obviously this isn't helpful in a script where drupal will just quietly terminate.
  
  Because CiviCRM and Drupal use different logic to identify your `civicrm.settings.php` and `settings.php` it is possible that the bootstrapping maybe attempting to look in different places.
  
  You can verify that both these files are loading during the bootstrap by inserting the magic line at the top and tail of each file:
  
  ```
      echo 'got here! #'.__LINE__.' '. __FILE__."\n";
  
  ```
  
  
  ---
  
  ### Answer by username_1 on 2016-12-24. Score: 1
  
  I would try
  
  ```
  civix civicrm:ping -v
  
  ```
  
  or even:
  
  ```
  civix civicrm:ping -vvv
  
  ```
  
  as the first thing as that could show something useful in the future.
  
  civix will fail silently if your civicrm.settings.php file:
  
  * is turning down phps error reporting and it hits an error
  * contains a `die` or `exit` command
  
  Eventually I figured out the problem as here:
  
  `// civicrm.settings.php
  // set up php to show errors:
  if (isset($_SERVER['HTTP_HOST']) && strstr($_SERVER['HTTP_HOST'], 'dev')) {
  error_reporting(E_ALL | E_STRICT);
  ini_set('display_errors', TRUE);
  ini_set('display_startup_errors', TRUE);
  }
  else {
  error_reporting(0); // <<< this is bad if you cant find your problem!!
  }`
  
  Inserting this in the else section confirmed that `$_SERVER['HTTP_HOST']` was undefined:
  
  `echo '$_SERVER: '.json_encode($_SERVER,JSON_PRETTY_PRINT)."\n";`
  
  So I was able to correct this just by setting up a mock value in bash to fix my civicrm.settings.php logic, and also to allow Drupal to find the right `sites/XXX/settings.php` file:
  
  ```
  declare -x HTTP_HOST=contact-qld-dev1.myorg.example.com
  
  ```
  
  > **Comments:**
  > **username_2**: It helped us too, with multi-site environnement, we needed to set CIVICRM_SETTINGS and HTTP_HOST. Thanks !  
  
  ---
  
  ### Answer by username_1 on 2016-12-31. Score: 0
  
  The other issue to be aware of is that `cv`, `civix` and other scripts bootstrap your CMS (eg Drupal) **after** it boots CiviCRM.
  
  So this means that your `civicrm.settings.php` file should not depend on settings set in you `settings.php` file.
  
  
  ---
  
  