0

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

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

2
  • 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 '13 at 1:07
  • @Jimajamma good call- I had not. I am going to try to use the PHP's chdir – Parag Sep 4 '13 at 1:43
1

I ended up using this code:

chdir('/path/to/drupal/sites/example.com/');
define('DRUPAL_ROOT', '/path/to/drupal/core');
require_once('/path/to/drupal/includes/bootstrap.inc');
drupal_override_server_variables(array('url' => 'http://example.com/'));
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

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

1
  • 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 – Dan Mantyla Apr 25 '19 at 18:31

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