Is it possible to bootstrap a particular drupal 'settings.php' ?

I've gotten bootstrap to work with the default site only.

  • have you read the comments regarding this inside settings.php and then called drupal_bootstrap() etc from the actual directory containing the non-default site?
    – Jimajamma
    Sep 4, 2013 at 1:07
  • @Jimajamma good call- I had not. I am going to try to use the PHP's chdir
    – pmagunia
    Sep 4, 2013 at 1:43

1 Answer 1


I ended up using this code:

define('DRUPAL_ROOT', '/path/to/drupal/core');
drupal_override_server_variables(array('url' => 'http://example.com/'));

It could perhaps be more efficient but it works from crontab.

  • And the URL of the script needs to be the site name as well. For example, if you have a script at http://default.com/script.php but it's trying to load a non-default site other.com you'll need to use http://other.com/script.php. If running from the command line then I don't know Apr 25, 2019 at 18:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.