PHP Cli + cron.php failing - only with Moodle

PHP Cli + cron.php failing - only with Moodle

by Danny Wahl -
Number of replies: 5

Just did a git pull of cvshead and I'm trying to setup cli for cron because I want the logs, but it fails when executed from terminal manually, or via cron.

Executing /admin/cron.php through moodle works perfectly.  I also have php-cli cron tast for cron working with mahara on this same server, so It's just something with Moodle (or the way i've set it up)

 

Anyways here's the error returned when I try to execute this:

PHP Warning: require(../config.php): failed to open stream:  No such file or directory in /var/www/www.subdomain.mysite.com/htdocs/moodle/admin/cron.php on line 45

PHP Fatal error: require(): Failed opening required '../config.php (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/www.subdomain.mysite.com/htdocs/moodle/admin/cron.php on line 45

here's the ownership on moodle/ dir:

drwxr-xr-x 42 www-data www-data 4096 2010-11-30 10:38 moodle

and for config.php

-rw-r--r-- 1 www-data www-data 22601 2010-11-30 10:38 config.php

the webroot is set to /moodle so touching subdomain.mysite.com will get the moodle index.

I tried looking through the tracker for this issue but I couldn't find anything.  any suggestions for me?  Thanks!

Average of ratings: -
In reply to Danny Wahl

Re: PHP Cli + cron.php failing - only with Moodle

by Danny Wahl -

ah!  I don't know why it added the href tags to that - they actually aren't in the thrown error.  Anyways, I was looking at the config for php (in Moodle and I noticed this:

Directive | Local Value | Master Value

include_path

/var/www/www.subdomain.mysite.com/htdocs/moodle/lib/zend:/var/www/www.subdomain.mysite.com/htdocs/moodle/lib/pear:.:/usr/share/php:/usr/share/pear

.:/usr/share/php:/usr/share/pear

So I'm not sure how to change the included path when run from php-cli vs php but that looks like what the problem is - something with include_path not being written with the local values.

In reply to Danny Wahl

Re: PHP Cli + cron.php failing - only with Moodle

by Danny Wahl -

Sorry, I should learn to read.

from /admin/cron.php

"it is also possible to use CLI script /admin/cli/cron.php instead, you cannot call this script from command line anymore"

 

Thanks.

In reply to Danny Wahl

Re: PHP Cli + cron.php failing - only with Moodle

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Yes, that's something written in CLI documentation.

I just saw this yesterday, looking at something else, but wasn't sure it was a valid information...

I think that such an important information should be in upgrading to Moodle 2.0 documentation, and cron documentation...

In reply to Séverin Terrier

Re: PHP Cli + cron.php failing - only with Moodle

by Jeremy Bascom -

I submitted minor edits to those pages as this "got" me too.

In reply to Jeremy Bascom

Re: PHP Cli + cron.php failing - only with Moodle

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Useful smile

In fact, i had added such information in french documentation, some months ago wink