alejandro52 Posted November 6, 2010 Share Posted November 6, 2010 I keep having the same problem when i run my script on the server. the error is Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/alliapop/public_html/ekloges2010/ekloges2010/eisagogi.php:1) in /home/alliapop/public_html/ekloges2010/ekloges2010/includes/session.php on line 1 I know i have to put session start at he very first line and i did but the problem keeps showing up. What else should i check? Quote Link to comment https://forums.phpfreaks.com/topic/217925-warning-session-start-line-1/ Share on other sites More sharing options...
Airzooka Posted November 6, 2010 Share Posted November 6, 2010 Is there anything else before the session_start()? Even a space or a line-break before the "<?php" will set this error off. Quote Link to comment https://forums.phpfreaks.com/topic/217925-warning-session-start-line-1/#findComment-1131003 Share on other sites More sharing options...
alejandro52 Posted November 6, 2010 Author Share Posted November 6, 2010 from what i see there is nothing. I tried everything, putting space and removing it pressing backspace and all. Quote Link to comment https://forums.phpfreaks.com/topic/217925-warning-session-start-line-1/#findComment-1131006 Share on other sites More sharing options...
Airzooka Posted November 6, 2010 Share Posted November 6, 2010 Are you printing anything in a different file, and then starting the session? If you have something like this, that will cause this error, too: index.php <?php echo 'Oh, hi!'; include 'sessions.php'; ?> sessions.php <?php session_start(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/217925-warning-session-start-line-1/#findComment-1131010 Share on other sites More sharing options...
mmarif4u Posted November 6, 2010 Share Posted November 6, 2010 http://www.phpfreaks.com/forums/php-coding-help/header-errors-read-here-before-posting-them/ Quote Link to comment https://forums.phpfreaks.com/topic/217925-warning-session-start-line-1/#findComment-1131015 Share on other sites More sharing options...
alejandro52 Posted November 6, 2010 Author Share Posted November 6, 2010 no i don;t print anything. Quote Link to comment https://forums.phpfreaks.com/topic/217925-warning-session-start-line-1/#findComment-1131055 Share on other sites More sharing options...
Pikachu2000 Posted November 6, 2010 Share Posted November 6, 2010 Whatever is on line 1 of eisagogi.php is generating the output. If there's even so much as a line feed before the opening <?php tag, it will send it to the browser. Quote Link to comment https://forums.phpfreaks.com/topic/217925-warning-session-start-line-1/#findComment-1131056 Share on other sites More sharing options...
Andy-H Posted November 6, 2010 Share Posted November 6, 2010 Did you use an editor that saves it as UTF-8 with BOM (byte order mark)? Quote Link to comment https://forums.phpfreaks.com/topic/217925-warning-session-start-line-1/#findComment-1131065 Share on other sites More sharing options...
alejandro52 Posted November 6, 2010 Author Share Posted November 6, 2010 IF i don't fix the error will there be any problems on my web page besides showing the warning? Quote Link to comment https://forums.phpfreaks.com/topic/217925-warning-session-start-line-1/#findComment-1131079 Share on other sites More sharing options...
alejandro52 Posted November 6, 2010 Author Share Posted November 6, 2010 Quote Did you use an editor that saves it as UTF-8 with BOM (byte order mark)? no . will notepad work? Quote Link to comment https://forums.phpfreaks.com/topic/217925-warning-session-start-line-1/#findComment-1131080 Share on other sites More sharing options...
PFMaBiSmAd Posted November 6, 2010 Share Posted November 6, 2010 Your code won't work because you cannot output anything to the browser before a statement that uses a header, like a session_start(), a setcookie(), or a header() redirect. If the BOM characters are the problem, you must either save the file as a UTF-8 encoded file without the BOM or you must save the file as a ANSI encoded file. Quote Link to comment https://forums.phpfreaks.com/topic/217925-warning-session-start-line-1/#findComment-1131083 Share on other sites More sharing options...
BlueSkyIS Posted November 6, 2010 Share Posted November 6, 2010 i just ran into this exact same problem yesterday, given an HTML file that I needed to add PHP to. <?php as the very first item on the very first line, session_start() on the second line, but I still got the headers/session_start() warning. As people are figuring out: I had to save the file as UTF-8 without BOM. The error then went away. (FYI: I use BBEdit/Mac) Quote Link to comment https://forums.phpfreaks.com/topic/217925-warning-session-start-line-1/#findComment-1131087 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.