I try to install the live_agent module. When I go to enable the module, I get the following errors:

Notice: Use of undefined constant DRUPAL_ROOT - assumed 'DRUPAL_ROOT' in /sites/all/modules/live_agent/live_agent.module on line 319

Warning: require_once(DRUPAL_ROOT/includes/errors.inc) [function.require-once]: failed to open stream: No such file or directory in /sites/all/modules/live_agent/live_agent.module on line 319

Fatal error: require_once() [function.require]: Failed opening required 'DRUPAL_ROOT/includes/errors.inc' (include_path='.:/usr/share/pear:/usr/share/php') in /sites/all/modules/live_agent/live_agent.module on line 319

The code causing the error is the following one.

 /* 318 */ function live_agent_buttons_form(&$form_state) {
 /* 319 */   global $base_url;
 /* 320 */ 
 /* 321 */   $settings = new liveagent_Settings();
 /* 322 */   $la_buttons_grid = $settings->getButtonsGridRecordset();
 /* 323 */   $recordset = $la_buttons_grid->toArray();
 /* 324 */ 
             // ...
 /* 373 */ }

Any help on debugging this would be greatly appreciated.

  • Hello, and welcome to DA! If you read the code and the error message, you'll see that line 319 is not a require_once as the error message states, so you appear to have pasted the wrong code. Bugs in modules a considered off-topic for this site. – Letharion Feb 25 '13 at 18:59
  • @Letharion I pasted the code that is at line 319 of the module file. – kiamlaluno Feb 25 '13 at 21:17
  • Do you have APC enabled? If so, try disabling it temporarily. – mpdonadio Feb 26 '13 at 2:42
  • @kiamlaluno I see. Well, that combination of code and error message still doesn't seem to make sense to me. :) – Letharion Feb 26 '13 at 7:09
  • @Letharion The errors seem caused from the autoload function, but I don't know why the error is for that line. – kiamlaluno Feb 26 '13 at 9:00

The error about the undefined constant DRUPAL_ROOT could be caused from the index.php file that is corrupted, or that is returned corrupted from APC, or similar extension. DRUPAL_ROOT is always defined when Drupal bootstraps.

 * Root directory of Drupal installation.
define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';

As for why the error message is reported for that module when a function that doesn't contain any reference to the constant is executed, I think that is caused from the autoload function Drupal registers, drupal_autoload_class(), which is trying to load the file containing the class.


Check your settings.php file. You might have either.

You set the wrong base URL, or maybe you did not set one and this module requires it.

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.