3

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.

  • great question. I am getting same behaviour. – ErichBSchulz Dec 24 '16 at 14:10
  • note that this also applies to the cv tool – ErichBSchulz Dec 31 '16 at 23:13
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";
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
  • It helped us too, with multi-site environnement, we needed to set CIVICRM_SETTINGS and HTTP_HOST. Thanks ! – veroniqueg Mar 8 '17 at 15:41
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.

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.