rvdb86 Posted February 11, 2009 Share Posted February 11, 2009 hi, i have run into trouble when starting a session. I get the following error: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/jeroncou/public_html/click4web/index.php:1) in /home/jeroncou/public_html/click4web/index.php on line 2 I know that session_start() should be the first line of the code and nothing should be before it. and that is how it is! here is my script: <?php session_start(); ?> <html> <head> </head> <body> <?php echo "test";?> </body> </html> the funny thing is that it only happens in my index.php file. if i change the name of the file it works fine ??? could something be wrong in my php.ini? i deleted it and still getting the same problem :'( some one please help me! Link to comment https://forums.phpfreaks.com/topic/144712-cannot-send-session-cache-limiter/ Share on other sites More sharing options...
gevans Posted February 11, 2009 Share Posted February 11, 2009 do you have any white spaces or lines before your openning tag: <?php Link to comment https://forums.phpfreaks.com/topic/144712-cannot-send-session-cache-limiter/#findComment-759355 Share on other sites More sharing options...
rvdb86 Posted February 11, 2009 Author Share Posted February 11, 2009 no nothing Link to comment https://forums.phpfreaks.com/topic/144712-cannot-send-session-cache-limiter/#findComment-759358 Share on other sites More sharing options...
rvdb86 Posted February 11, 2009 Author Share Posted February 11, 2009 the strange thing is that exactly the same code works when i change the file name from index.php. this has got me really confused Link to comment https://forums.phpfreaks.com/topic/144712-cannot-send-session-cache-limiter/#findComment-759518 Share on other sites More sharing options...
PFMaBiSmAd Posted February 11, 2009 Share Posted February 11, 2009 The second most common reason why you can get an "output started at line 1" error message is if the file has been saved with UTF-8 encoding and the BOM (Byte Order Mark) characters are content that is being output to the browser. Save your file as ANSI/ASCII. Link to comment https://forums.phpfreaks.com/topic/144712-cannot-send-session-cache-limiter/#findComment-759617 Share on other sites More sharing options...
rvdb86 Posted February 11, 2009 Author Share Posted February 11, 2009 ok thankyou good to know. i paniced and delete the whole site and uploaded everything from new :-\ atleast if this happens in the future i know whats wrong. thanks Link to comment https://forums.phpfreaks.com/topic/144712-cannot-send-session-cache-limiter/#findComment-759618 Share on other sites More sharing options...
PFMaBiSmAd Posted February 11, 2009 Share Posted February 11, 2009 Your original source files might still have BOM characters. When you FTP in ASCII mode, the BOM characters are stripped. When you FTP in BINARY mode, the BOM characters are transfered intact. Link to comment https://forums.phpfreaks.com/topic/144712-cannot-send-session-cache-limiter/#findComment-759621 Share on other sites More sharing options...
killah Posted February 11, 2009 Share Posted February 11, 2009 Did it work? If not you can alway's try: ob_start(); underneath session_start(); Link to comment https://forums.phpfreaks.com/topic/144712-cannot-send-session-cache-limiter/#findComment-759623 Share on other sites More sharing options...
PFMaBiSmAd Posted February 11, 2009 Share Posted February 11, 2009 Please read the error. Output is occurring on line 1 of the file. Putting ob_start() in the code won't fix the problem. Link to comment https://forums.phpfreaks.com/topic/144712-cannot-send-session-cache-limiter/#findComment-759625 Share on other sites More sharing options...
killah Posted February 11, 2009 Share Posted February 11, 2009 See.. the problem is on another coding forum some one earlier today got the exact same problem with headers already sent. I told him to put ob_clean(); some one else said put ob_start(); and it worked. So it's worth a try! Link to comment https://forums.phpfreaks.com/topic/144712-cannot-send-session-cache-limiter/#findComment-759629 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.