Link Posted November 1, 2007 Share Posted November 1, 2007 I have a series of included files, once of which contains a session start at the top. The included file gives the following error: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/blah/public_html/mayo/session.php:1) in /home/blah/public_html/mayo/session.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/blah/public_html/mayo/session.php:1) in /home/blah/public_html/mayo/session.php on line 2 And the code is simply three lines: <?php session_start(); ?> Any clue? Why is it throwing two errors and why is there an error to begin with? Thanks! Link to comment https://forums.phpfreaks.com/topic/75644-session-stupidity/ Share on other sites More sharing options...
rajivgonsalves Posted November 1, 2007 Share Posted November 1, 2007 there must be some special character before the <? tag or some whitespaces Link to comment https://forums.phpfreaks.com/topic/75644-session-stupidity/#findComment-382754 Share on other sites More sharing options...
revraz Posted November 1, 2007 Share Posted November 1, 2007 Remove the whitespace after <?php Link to comment https://forums.phpfreaks.com/topic/75644-session-stupidity/#findComment-382755 Share on other sites More sharing options...
Link Posted November 1, 2007 Author Share Posted November 1, 2007 There literally is none. There is no whitespace before or after the tags. I have retyped it twice now to no avail... Anything else? ->Ryan Link to comment https://forums.phpfreaks.com/topic/75644-session-stupidity/#findComment-382757 Share on other sites More sharing options...
revraz Posted November 1, 2007 Share Posted November 1, 2007 What type of editor are you using? Maybe it's throwing in some whitespace you can't see. Link to comment https://forums.phpfreaks.com/topic/75644-session-stupidity/#findComment-382759 Share on other sites More sharing options...
rajivgonsalves Posted November 1, 2007 Share Posted November 1, 2007 actually in the files that you are including the "session.php" file Link to comment https://forums.phpfreaks.com/topic/75644-session-stupidity/#findComment-382760 Share on other sites More sharing options...
Link Posted November 1, 2007 Author Share Posted November 1, 2007 EnginSite Editor Link to comment https://forums.phpfreaks.com/topic/75644-session-stupidity/#findComment-382761 Share on other sites More sharing options...
Link Posted November 1, 2007 Author Share Posted November 1, 2007 Well, so, I do include it elsewhere but this error is from that script which contains those three lines alone. I figured it would simplify things. Link to comment https://forums.phpfreaks.com/topic/75644-session-stupidity/#findComment-382762 Share on other sites More sharing options...
rajivgonsalves Posted November 1, 2007 Share Posted November 1, 2007 actually if you have already outputted some data in another file then try to include "session.php" it would throw the error as this file is trying to set the header Link to comment https://forums.phpfreaks.com/topic/75644-session-stupidity/#findComment-382764 Share on other sites More sharing options...
Link Posted November 1, 2007 Author Share Posted November 1, 2007 Right, yes, I know. But I get the error even when only looking at the file. Link to comment https://forums.phpfreaks.com/topic/75644-session-stupidity/#findComment-382765 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.