If you run drupal from command line (p.e. cron.php) $base_path is not set to it's default value "/" in conf_init(), because dirname() always returns a value that's interpreted as TRUE.
If $_SERVER['SCRIPT_NAME'] doesn't contain a directory the return value of dirname($_SERVER['SCRIPT_NAME']) is ".". So in the current implementation $base_path is set to "/./" instead of "/" if you run cron.php. I attached a patch that solves the issue.
| Comment | File | Size | Author |
|---|---|---|---|
| bootstrap_5_7.patch | 533 bytes | mkalkbrenner |
Comments
Comment #1
cmsproducer commentedI have tested the code on 5.7x and it generates an IF error even if the syntax structure is verified to be correct.
Parse error: syntax error, unexpected T_IF in /home/xxxxxxxxxxx/public_html/_ngreens/includes/bootstrap.inc on line 266
Comment #2
mkalkbrennerWe are running drupal 5.7 on our linux servers with bootstrap_5_7.patch applied without any errors.
Comment #3
drummcron.php is not actually designed to be run from the command line.
In Drupal 6 and above, there is scripts/drupal.sh which does make this possible and handles $base_path in all situations, including sites installed subdirectories. drupal.sh does work the same on Drupal 5.x.
Comment #4
murzMany hostings runs cron task from command line and have no permission to change method to http.
And Drupal in this state can't get $_SERVER['HTTP_HOST'] value and other.
For setting correct $base_url I do this changes:
change to: