php -q /home/mysite/public_html/cron.php i'm using this command to run cron and get this error
error php 26 Nov 2006 - 08:00 is_dir() [ Anonymous
error php 26 Nov 2006 - 08:00 fclose(): supplied argument is not a valid stream ... Anonymous
error php 26 Nov 2006 - 08:00 flock(): supplied argument is not a valid stream ... Anonymous
error php 26 Nov 2006 - 08:00 ftruncate(): supplied argument is not a valid stream ... Anonymous
error php 26 Nov 2006 - 08:00 fwrite(): supplied argument is not a valid stream ... Anonymous
error php 26 Nov 2006 - 08:00 rewind(): supplied argument is not a valid stream ... Anonymous
error php 26 Nov 2006 - 08:00 flock(): supplied argument is not a valid stream ... Anonymous
error php 26 Nov 2006 - 08:00 fopen(data/.1.banner.cache) [ Anonymous
error php 26 Nov 2006 - 08:00 fopen(data/.1.banner.cache) [
and this email:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent in /home/mysite/public_html/includes/bootstrap.inc on line 760
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/mysite/public_html/includes/bootstrap.inc:760) in /home/mysite/public_html/includes/bootstrap.inc on line 760
Comments
Hmm
I'm having this same error, but no one seems to be able to fix it.
It does seem, however, that the cron functions are working. At least my logs are clearing out.
Nancy W.
now running 5 sites on Drupal so far
Drupal Cookbook (for New Drupallers)
Adding Hidden Site Design Notes
NancyDru
What error?
What command are you using?
What errors do you get?
Did you type "cron" in the search-box here for cron setup instructions?
Yes
Not only did I search, but I have also added to the documentation. I could not find an answer for this, even though it has been reported before. All the threads just stop with no answer.
For my set up, http://drupal.org/node/120625
Errors:
Yes, I have checked to see if there are extra blanks at the end.
As I said, it does appear to be running Cron, but I get these errors every time.
Nancy W.
now running 5 sites on Drupal so far
Drupal Cookbook (for New Drupallers)
Adding Hidden Site Design Notes
NancyDru
cron
Hi.
(It's I with the "candles lightning" thingy. Hope you are not angry. I had to demonstrate, and that was the gentlest demo I could figure out...)
Now,
You're invoking cron.php via php directly. Why don't you follow the instructions and use 'wget' or 'lynx', or any other command that behaves like a browser, instead of via PHP directly ('php -q') ?
Drupal reads some Apache variables in the initialization process, variables which are missing when running under 'php -q'. I suspect this leads to the warnings you see.
Could you please change the above command to:
And tell me what happens (check your log).
No shell access
I do not have shell access and cannot get it at my current host. And then, I am very Linux illiterate.
No, I'm not angry - you showed me a problem that I had on all my sites. But, yes, I recognized your ID, and I'm seeing it a lot in my recent posts list today.
Hmm, I just went to the "Advanced" tab and there is a help tip there that says to use
GET http://nancywichmann.com/cron.phpso I set it up to run shortly.Nancy W.
now running 5 sites on Drupal so far
Drupal Cookbook (for New Drupallers)
Adding Hidden Site Design Notes
NancyDru
cron
GET is fine. GET does the same as wget/lynx/links/curl do.
Hope problem is solved.
Looks like it's working
Nancy W.
now running 5 sites on Drupal so far
Drupal Cookbook (for New Drupallers)
Adding Hidden Site Design Notes
NancyDru
Apples & Oranges
There are times when you can't really want to use wget such as when the cron task would timeout php plus it puts additional load on Apache that is simply not needed. Drupal really should enable itself to be bootstrapped w/o assuming the code is being called from a browser. There are very legitimate use-cases where there is a need to load nodes, load users, do processing, etc. without the need for those things that require a browser.
That is if Drupal wants to be taken serious in Enterprise contexts then Drupal really should enable this. Much of Enterprise work is batch processing.
...
I agree. (check out drush.)
Same problem
I can't use GET or WGET with my host, but
/usr/bin/php -q /home/myaccount/public_html/cron.php> /dev/nullgenerates Watchdog errors
is_dir() [although cron appears to be working OK.The exact same cron command never did this with Drupal 4.6, it's only started happening since I u/g to 4.7 (same path - in public_html)
If I execute cron.php from the browser, there are no errors.
Regards
Tony Sleep http://tonysleep.co.uk
...
First 'cd' to the directory containing cron.php. Only then execute php. See the command in my reply above.
it's 'wget', all lowercase.
Where did you type this? So you have shell access. Do
ls /usr/binto find out all the commands on that system and post the results here.I typed caps for emphasis -
I typed caps for emphasis - I can't use wget or get on my system because the hosting co. disallow those commands for security reasons.
I don't have shell access either. The command string is entered via CPanel, for cron tasks, and is all I can do. No shell access and CPanel execution are pretty usual on shared hosts, I think.
As I say, it used to work without the PHP error with Drupal 4.6 - see http://drupal.org/node/84472#comment-170865 - but since upgrading 4.7 cron.php gets mildly upset and gives the Watchdog error. It still seems to complete correctly however, and tasks are executed as expected.
Regards
Tony Sleep http://tonysleep.co.uk
Ask about A records
I had a site that was going fine under 4.7.4, but when I upgraded to 5.1, cron would occasionally tell me it couldn't find my site. After arguing with the host for a while, I just collected all the failures and sent them a long list. They finally realized that they needed to change my domain's A record (what ever that is).
That's why it can be good to remove the "dev>null" from the command.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
I only added dev>nul to
I only added dev>nul to suppress the emails once I knew it was working. The emails contain a few cookie errors which also occurred with 4.6, and that's all - and I assume that's simply because cron.php run from a browser uses a few cookies which are unavailable by this method. It never fails to find the site or run OK despite the Watchdog error. Which I can't say I'm bothered about, except pink makes me nervous :)
Regards
Tony Sleep http://tonysleep.co.uk
GET however should be uppercase!
After a little confusion trying to get my cron working via this thread, it seems that GET should be uppercase and wget should be lowercase.
as far as I can tell anyway.
More info
I have now tried
cd /<myusername>/home/public_html/ ; /usr/php/php -q cron.phpfrom Cpanel. Results are no different.Cron appears to work OK but I still get the Watchdog log errors
is_dir() [function.is-dir]: Stat failed for files/images/temp (errno=13 - Permission denied) in /home/<myusername>/public_html/includes/file.inc on line 639.I have no control over permissions of files/images/temp. Can't even see it: files is 740 and I can't chmod, and probably shouldn't anyway, as I'm using Drupal's private d/l method. However this did not occur with Drupal 4.6 cron.php.
and email reports contain
Which I guess is a benign cookie issue caused by running from CPanel rather than a browser.
is here a redaction for the real path.
Regards
Tony Sleep http://tonysleep.co.uk
...
This directory is used by image.module to store temporary image files. This cron job cleans this directrory of files older than X hours.
I believe it's safe to chmod 775, or even 777, this directory, as it contains temporary images -- created while uploading images. It's your decision, of course.
You can run the following PHP code:
form whithin Drupal (set a node's "input format" to "PHP".)
===
Look, if all this bothers you, create a file 'whatever.php' (where 'index.php' resides). In it call cron:
Executing this PHP script is just like executing 'wget' or 'GET' or whatever.
(navigate once, using your browser, to http://example.com/whatever.php ; if you see '2 + 2 = 4' then the script is OK.)
...
Thanks, moofie! Creating a new script with the file_get_contents() method is a great solution, since my client's host does not allow use of wget or GET.