I have the correct path for cron.php to run, however, when it runs I get warnings.

Here's the actual code for cron.php:

// $Id: cron.php,v 1.36 2006/08/09 07:42:55 dries Exp $

/**
 * @file
 * Handles incoming requests to fire off regularly-scheduled tasks (cron jobs).
 */

include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
drupal_cron_run();


That's it. It ends there without even "

". Is it supposed to be that way?

Here are the warnings:
Warning: main(./includes/bootstrap.inc): failed to open stream: No such file or directory in /home/angelopc/public_html/cron.php on line 9

Warning: main(): Failed opening './includes/bootstrap.inc' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/angelopc/public_html/cron.php on line 9

Fatal error: Call to undefined function: drupal_bootstrap() in /home/angelopc/public_html/cron.php on line 10

Comments

WorldFallz’s picture

Yes, that's the correct file. Not sure what your problem is... do you have an includes directory under your drupal base directory? Are the permissions set correctly? When do you get those error messages?

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz

NigelFK’s picture

I've looked around all the fixes that people have reported for the various similar Cron problems but this post appears to be the only one that is like the one I'm getting.

Here is the error:

PHP Warning: include_once(./includes/bootstrap.inc): failed to open stream: No such file or directory in /hsphere/local/home/bla/bla/cron.php on line 9
PHP Warning: include_once(): Failed opening './includes/bootstrap.inc' for inclusion (include_path='.:/hsphere/shared/apache/libexec/php5ext/php/') in /hsphere/local/home/bla/bla/cron.php on line 9
PHP Fatal error: Call to undefined function drupal_bootstrap() in /hsphere/local/home/bla/bla/cron.php on line 10

I do have an includes directory under my Drupal base directory and the permissions are set to 6,4,4 (i.e. user read/write, group read, others read).

Can anyone help?

Nigel

NigelFK’s picture

Bump

letsbuild’s picture

I'm getting this same problem too...

mtsanford’s picture

Your cron task is probably configured incorrectly.

You may need to tell php to set the working directory to the drupal root directory, since the include paths are relative to that directory.

Share what your cron settings are and you might get more help.

NigelFK’s picture

From one problem to another!

I accidentally deleted and had to re-type my command line which is now /hsphere/local/home/blabla/blabla.com/web/cron.php (I only mention this because I am now not getting warning emails which leads me to suspect that my Cron settings were indeed wrong in some way)

So, I am now getting emails which report no errors and yet Drupal reports that Cron has not been run! I can't see how this can happen.

The emails say the following...

==========================================================
/hsphere/local/home/blabla/blabla/bla/cron.php: line 1: ?php: No such file or directory
/hsphere/local/home/blabla/blabla/bla/cron.php: line 2: //: is a directory
/hsphere/local/home/blabla/blabla/bla/cron.php: line 4: /bin: is a directory
/hsphere/local/home/blabla/blabla/bla/cron.php: line 5: blabla: command not found
/hsphere/local/home/blabla/blabla/bla/cron.php: line 6: syntax error near unexpected token `('
/hsphere/local/home/blabla/blabla/bla/cron.php: line 6: ` * Handles incoming requests to fire off regularly-scheduled tasks (cron jobs).'
==========================================================

I checked inside cron.php and this is what the file says...

==========================================================
<?php
// $Id: cron.php,v 1.36 2006/08/09 07:42:55 dries Exp $

/**
* @file
* Handles incoming requests to fire off regularly-scheduled tasks (cron jobs).
*/

include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
drupal_cron_run();
==========================================================

Any ideas?
Nigel

kareeser’s picture

The problem is as mtsanford described. The current working directory is not set correctly, thus cron.php will fail unless you are running it from /path/to/drupal/

I solved this by adding a line to the head of the file:
chdir('/path/to/drupal');

Then it will work irregardless of where the command is run.

hemmer’s picture

Thanks, this worked perfectly. I guess not every php config includes the current directory by default.