Cron.php didn't work from crontab

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


43 points

Hello. Sorry for my bad english.

I'm trying to set cron.php calls from crontab.
When i run cron.php from browser (chmod 755) - it works, when its calling by crontab - errors happen.

Here is these errors:
PHP Warning: main(sites/default/settings.php): failed to open stream: No such file or directory in /home/_myaccount_/www/includes/bootstrap.inc on line 642
PHP Warning: main(): Failed opening 'sites/default/settings.php' for inclusion (include_path='.:') in /home/_myaccount_/www/includes/bootstrap.inc on line 642
PHP Warning: main(includes/database.inc): failed to open stream: No such file or directory in /home/_myaccount_/www/includes/bootstrap.inc on line 643
PHP Warning: main(): Failed opening 'includes/database.inc' for inclusion (include_path='.:') in /home/_myaccount_/www/includes/bootstrap.inc on line 643
PHP Warning: main(includes/session.inc): failed to open stream: No such file or directory in /home/_myaccount_/www/includes/bootstrap.inc on line 644
PHP Warning: main(): Failed opening 'includes/session.inc' for inclusion (include_path='.:') in /home/_myaccount_/www/includes/bootstrap.inc on line 644
PHP Warning: main(includes/module.inc): failed to open stream: No such file or directory in /home/_myaccount_/www/includes/bootstrap.inc on line 645
PHP Warning: main(): Failed opening 'includes/module.inc' for inclusion (include_path='.:') in /home/_myaccount_/www/includes/bootstrap.inc on line 645
PHP Fatal error: Call to undefined function: db_fetch_object() in /home/_myaccount_/www/includes/bootstrap.inc on line 199

Note: this errors have appears only when calling cron.php from crontab (in other scripts bootstrap.inc works fine).

In bootstrap.inc (642-645):
include_once "$config/settings.php";
include_once 'includes/database.inc';
include_once 'includes/session.inc';
include_once 'includes/module.inc';

All inc-files are found where it is necessary (in includes/).

Can you help me?



5 points

I'm hope, that my posts will be useful for somebody.

I've just add in bootstrap.php
if (getcwd()=='/home/my_account') chdir('my_syte/www/');

For example, it's can to look as:
if (getcwd()=='/home/host12345') chdir('example.com/www/');

With best regards, OZ. Drupal is genius system! :)

Anonymous's picture
Created by Anonymous

Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.