CMSB Cron Run Manually Header Info Warning
3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 13, 2015 (RSS)
By Steve99 - January 13, 2015
Hello,
I ran the example Cron manually in browser and am receiving a "cannot modify header info" warning. This portion of the example Cron:
if (!inCLI()) { // if "Running Manually" from web
header("Content-type: text/plain", true);
set_time_limit(60*5); // allow up to 5 minutes to complete task
session_write_close(); // End the current session and store session data so locked session data doesn't prevent concurrent access to CMS by user while this script is running
}
is giving this warning:
Warning: Cannot modify header information - headers already sent by (output started at /full/server/path/www/htdocs/cmsAdmin/lib/common.php:1626) in /full/server/path/www/htdocs/cmsAdmin/plugins/cron-example.php on line 37
My sample Cron
--------------------------------------------------------------------------------
The current time is: 2015-01-13 12:14:47
Done!
I've included that chunk of code in a Cron I'm working on as well. The task completes, but that error is displayed/logged. Thoughts?
Thanks,
Steve
By claire - January 13, 2015
Hi Steve
This is a really common error. It just means that the page has already set the header and started doing something else, and by the time it gets to run the cron script, it can't execute this line:
header("Content-type: text/plain", true);
Therefore, it throws an error.
You should be able to comment out that line if you're running it manually, as far as I know. It shouldn't affect the script.
Claire Ryan
interactivetools.com
Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
By Steve99 - January 13, 2015
Hi Claire,
I thought that to be the case, just wanted to confirm. Thanks!
Cheers,
Steve