Search code examples
phpdrupaldrupal-7

Drupal is not bootstrapped


When I try to manually bootstrap Drupal from a standalone PHP script it just silently fails. I do the following:

error_reporting(E_ALL);
ini_set("display_errors", 1);

chdir('/var/www/dev_site');
define('DRUPAL_ROOT', getcwd());
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; 
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

die('drupal loaded');

The script fails on drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); The last die command never gets executed, the script just terminates wthout any error message.

OS: CentOS 6.6, PHP: 5.5.27: Drupal: 7.34

Can anyone advise please?


Solution

  • Solved! After digging into drupal_bootstrap function I found that it failed while executing init hooks. Soon I found that it failed on Restrict IP module hook. The reason is that 127.0.0.1 IP address was not whitelisted. Once I added it to the whitelist it started to work.