Hi -- new to the forums, but have been running my site with Drupal for several months and everything has been great.

Right now my site is running Drupal 4.5.2

I guess around a month ago, I started to get emailed errors everytime the following command was activated as a cron job:

php -q /home2/mysite/public_html/drupal/cron.php

The email states the following:

Warning: session_start(): Cannot send session cookie - headers already sent in /home2/mysite/public_html/drupal/includes/session.inc on line 10

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home2/mysite/public_html/drupal/includes/session.inc:10) in /home2/mysite/public_html/drupal/includes/session.inc on line 10

------

My host does not allow wget (due to security issues, I believe)...

Keep in mind everything was running fine for quiet some time before I started to get these errors.

The one stupid thing I did was mass-delete stories through myPHP (because I needed to delete everything)... But even for a few weeks AFTER I did that, I still did not get any errors, so I don't think that is the reason for my problems.

I was running 4.5.1 when this started but I updated to 4.5.2 in hopes that it would fix my problems. Unfortunately, it didn't.

Previously, it was suggested that I change the order of some lines in one of the .inc files (can't recall which), but doing so effectively killed my site so I had to change that back immediately.

More recently, I dropped in to the support IRC channel and someone suggested trying to run cron.php through my web browser. Doing that, I got a blank page and in my administration page it says a cron run was completed.

It's also worth mentioning that as far as I can tell, my site is running fine, however I was under the impression that running cron every day or so would help keep it running nicely.

Please advise.

Thanks.

Comments

Jo Wouters’s picture

The script tries to set cookies, but 'something' has already sent output.
(cookies always have to be set before any output is sent).

These are two possible causes I can think of:

  • the script gets an error (or warning) before it executes the session_start() (thats line 10 in session.inc). But you should have noticed that by executing the script via your browser.

  • you might have added an empty line somewhere outside the php-tags, causing an empty line to be written. I guess you didn't change any of the .inc-files. But you might have changed the $config.php-script ? (includes/conf.php). Make sure there is nothing (and certainly no empty line) before the first <?php

Please let us know if this solved your problem.

blizzard08’s picture

Thanks for your help. I'm taking a look at conf.php now and I see there is an empty line at the very end of the file, such as:
---------------
#
# PHP settings:
#
# To see what PHP settings are known to work well, take a look at
# the .htaccesss file in Drupal's root directory. If you get
# unexpected warnings or errors, double-check your PHP settings.

# If required, update PHP's include path to include your PEAR directory:
// ini_set("include_path", ".:/path/to/pear");

?>
(empty line)
--------------------
Could this be the cause? I am going to see if deleting that line does anything.

javanaut’s picture

That's probably it. No newlines should be in the conf file outside of the <?php and ?> tags.

Mateo’s picture

Try using this for your cron job:

/usr/local/bin/lynx -source http://www.yoursite.com/cron.php

Of course you'd have to change the location of your lynx program if it isn't in /usr/local/bin/lynx

Good luck.

Mateo

tejaswi.manjunath@tejas.in’s picture


/usr/local/bin/lynx -cfg=lynx.cfg -accept_all_cookies -source http://www.yoursite.com/cron.php

accccept all cookies - has to be added - as this script tries to store a cookie...

and if the lynx.cfg was not installed as it was not in my host just copy one from you linux box to your root directory of the account and mention that on the cmdLine with: -cfg=FILENAME

my 2 cents....
tejas.

tejaswi.manjunath@tejas.in’s picture

i wanted to know what the cron.php is doing, enabling this will update my news aggregator ???

i have the news aggregator to update itself every 15minutes, but this never happens ???

i have to go in and update it by hand....i have addes the cronphp to crontab !! what else do i need to do !!!

svartling@svartling.hopto.org’s picture

I had the same problem, but it was a program called PeerGuardian 2 that blocked the cron job and made the exact same error message. When I disable PeerGuardian I could cron agian.

Probably it was some link in some of the articles on my site that was blocked by PeerGuardian, so the Cron Job didn't complete.

http://svartling.hopto.org/