busillis Posted March 31, 2009 Share Posted March 31, 2009 I'm getting these two errors, but this was working fine earlier today!? Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /xxxx/xxxx/xxxx/xxxx/project/editaccount-page.php:2) in ./header.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /xxxx/xxxx/xxxx/xxxx/project/editaccount-page.php:2) in ./header.php on line 2 Any help would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/151960-warning-session_start-cannot-send-session-cookie-cache-limiter-headers/ Share on other sites More sharing options...
limitphp Posted March 31, 2009 Share Posted March 31, 2009 its probably because you have some output BEFORE you call session_start() could be comments, etc.... Quote Link to comment https://forums.phpfreaks.com/topic/151960-warning-session_start-cannot-send-session-cookie-cache-limiter-headers/#findComment-797975 Share on other sites More sharing options...
revraz Posted March 31, 2009 Share Posted March 31, 2009 Well what did you change? I'm getting these two errors, but this was working fine earlier today!? Quote Link to comment https://forums.phpfreaks.com/topic/151960-warning-session_start-cannot-send-session-cookie-cache-limiter-headers/#findComment-797979 Share on other sites More sharing options...
busillis Posted March 31, 2009 Author Share Posted March 31, 2009 Header: <?php session_start(); There is nothing there in header, line 2 is session start...!? Quote Link to comment https://forums.phpfreaks.com/topic/151960-warning-session_start-cannot-send-session-cookie-cache-limiter-headers/#findComment-797980 Share on other sites More sharing options...
busillis Posted March 31, 2009 Author Share Posted March 31, 2009 Well what did you change? I'm getting these two errors, but this was working fine earlier today!? Nothing... I tested it from work today (only viewing the pages and using the functionality; did not even open the code. I ran it just now and i'm getting this... Quote Link to comment https://forums.phpfreaks.com/topic/151960-warning-session_start-cannot-send-session-cookie-cache-limiter-headers/#findComment-797981 Share on other sites More sharing options...
PFMaBiSmAd Posted March 31, 2009 Share Posted March 31, 2009 Read the error. It tells you where the output is being started at, that is preventing the headers from being sent. Quote Link to comment https://forums.phpfreaks.com/topic/151960-warning-session_start-cannot-send-session-cookie-cache-limiter-headers/#findComment-797982 Share on other sites More sharing options...
busillis Posted March 31, 2009 Author Share Posted March 31, 2009 The weird thing is when hitting refresh, sometimes the error disappears and other times it does not!? Quote Link to comment https://forums.phpfreaks.com/topic/151960-warning-session_start-cannot-send-session-cookie-cache-limiter-headers/#findComment-797986 Share on other sites More sharing options...
busillis Posted March 31, 2009 Author Share Posted March 31, 2009 Read the error. It tells you where the output is being started at, that is preventing the headers from being sent. Unfortunately I don't understand it though? If I did, I wouldn't be here :-P Is the problem in the header file, or the file that is invoking the header (requiring it) ? Quote Link to comment https://forums.phpfreaks.com/topic/151960-warning-session_start-cannot-send-session-cookie-cache-limiter-headers/#findComment-797993 Share on other sites More sharing options...
premiso Posted March 31, 2009 Share Posted March 31, 2009 Output was started meaning an echo or print or whitespace at line 2 of editaccount-page.php. This is causing an issue in header.php on line 2 which is where session_start is being called. Quote Link to comment https://forums.phpfreaks.com/topic/151960-warning-session_start-cannot-send-session-cookie-cache-limiter-headers/#findComment-798000 Share on other sites More sharing options...
busillis Posted March 31, 2009 Author Share Posted March 31, 2009 OK, I think I solved it... I removed "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">" from above <?php in the invoking file. (i.e. edit page) Would this be the solution? I just don't want this problem to mystically reappear! btw I really appreciate your help here guys. Quote Link to comment https://forums.phpfreaks.com/topic/151960-warning-session_start-cannot-send-session-cookie-cache-limiter-headers/#findComment-798001 Share on other sites More sharing options...
busillis Posted March 31, 2009 Author Share Posted March 31, 2009 No, its not. Its all falling apart. I really don't understand this. It was working perfectly fine earlier and I hadn't changed anything. Even someone else tried out the system and they did not get any errors. Quote Link to comment https://forums.phpfreaks.com/topic/151960-warning-session_start-cannot-send-session-cookie-cache-limiter-headers/#findComment-798007 Share on other sites More sharing options...
revraz Posted March 31, 2009 Share Posted March 31, 2009 Having output before the session_start() statement will cause the issue. Use notepad to open your files and check for any whitespace or special characters that may be there. Quote Link to comment https://forums.phpfreaks.com/topic/151960-warning-session_start-cannot-send-session-cookie-cache-limiter-headers/#findComment-798024 Share on other sites More sharing options...
PFMaBiSmAd Posted March 31, 2009 Share Posted March 31, 2009 I removed "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">" from above <?php in the invoking file. (i.e. edit page) Before you started hacking your code and deleting things, did you check if that line of code was supposed to be in that file? Either your hosting company changed the output buffering setting in php.ini (in which case they should have warned you), or somehow your files are being changed. If your hosting company changed a setting, the solution is different than if your files are being changed. Quote Link to comment https://forums.phpfreaks.com/topic/151960-warning-session_start-cannot-send-session-cookie-cache-limiter-headers/#findComment-798043 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.