hi I have stored my db details in a file called config.php config.php <?php session_start(); //error_reporting(E_ALL); ini_set('display_errors',0); $glob['dbhost'] = "localhost"; ..... ..... ..... PHP: I have a cron file which runs perfectly fine. Cron.php <?php include("inc/config.php"); $to_mail = 'myemail@gmail'; $sql=$dclass->select('*','tbl_test'); ..... ..... ..... PHP: This cron works perfectly fine. Now i need another cron file. I copied the same exact content of this cron file and created a new cron file called cron2.php and set the cron timing to every 1 minutes and i got this error in the error log [18-Jan-2013 20:30:01] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent in /home/xxxxx/public_html/xxxx/inc/config.php on line 2 [18-Jan-2013 20:30:01] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent in /home/xxxxx/public_html/xxxx/inc/config.php on line 2 I really don't understand how come if its 1 cron file its working flawlessly and if its 2 different cron files it gives this error. Can anyone suggest a work around? Thanks Sam
Are you sure the file isn't something like <?php include("inc/config.php"); $to_mail = 'myemail@gmail'; $sql=$dclass->select('*','tbl_test'); ..... ..... ..... Code (markup): That blank line will send headers, so you can't send headers in your code unless you have output buffering on. (Just make sure that the include comes before any printable content, like a blank line.)
copy and paste the file into a new one and i think it will work, sometimes you have invisable characters (i have been there...)