Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obscure errors when CMS configuration not fully readable #81

Open
brettcs opened this issue Sep 27, 2016 · 1 comment
Open

Obscure errors when CMS configuration not fully readable #81

brettcs opened this issue Sep 27, 2016 · 1 comment

Comments

@brettcs
Copy link

brettcs commented Sep 27, 2016

Debian 8's drupal7 package splits the Drupal configuration into two files: a general settings.php file, which is owned root:root and has 0644 permissions, and a dbconfig.php file, which is owned root:www-data and has stricter 0640 permissions. settings.php runs require_once('dbconfig.php');.

Unless you're running as the web server user www-data, trying to run civix with this configuration generates an error about failing to load dbconfig.php, and causes civix to fail:

shell% civix generate:module org.brettcsmith.teste
License set to AGPL-3.0 (authored by Brett Smith <brettcsmith@brettcsmith.org>)
If this is in error, please correct info.xml and LICENSE.txt
Initalize module org.brettcsmith.teste
Write org.brettcsmith.teste/info.xml
Write org.brettcsmith.teste/teste.php
Write org.brettcsmith.teste/teste.civix.php
Write org.brettcsmith.teste/LICENSE.txt
PHP Fatal error:  require_once(): Failed opening required 'dbconfig.php' (include_path='.:/var/lib/drupal7/modules/civicrm:/var/lib/drupal7/modules/civicrm/packages:/var/lib/drupal7/modules/civicrm/vendor/tecnickcom:/var/lib/drupal7/modules/civicrm/vendor/phpseclib/phpseclib/phpseclib:.:/usr/share/drupal7/sites/default/modules/civicrm:/usr/share/drupal7/sites/default/modules/civicrm/packages:.:/usr/share/php:/usr/share/pear') in /etc/drupal/7/sites/default/settings.php on line 182

Fatal error: require_once(): Failed opening required 'dbconfig.php' (include_path='.:/var/lib/drupal7/modules/civicrm:/var/lib/drupal7/modules/civicrm/packages:/var/lib/drupal7/modules/civicrm/vendor/tecnickcom:/var/lib/drupal7/modules/civicrm/vendor/phpseclib/phpseclib/phpseclib:.:/usr/share/drupal7/sites/default/modules/civicrm:/usr/share/drupal7/sites/default/modules/civicrm/packages:.:/usr/share/php:/usr/share/pear') in /etc/drupal/7/sites/default/settings.php on line 182

I addressed this problem on my system by giving my local user account read access to dbsettings.php.

I know it's probably not possible to anticipate every possible problem that could occur while loading a user's CRM settings, but it might be nice if civix could notice that an error happened and explain a little more that this means it couldn't fully load the CRM configuration. Especially since this is Debian's stock configuration, it seems like this could be a common error for users to run into.

@totten
Copy link
Owner

totten commented Oct 19, 2016

Hmm, yeah, I can see how the clarity/obscurity of that error would be... debatable. The message does seem like a pretty accurate description of the problem, and I'm struggling to imagine a general error-handler/error-reporter which would make it clearer. (Unless you just handle it has a special-case specifically for Debian's Drupal package?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants