neugi Posted November 30, 2010 Share Posted November 30, 2010 Hi, i've got a strange problem: i get this errors: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at e:\Internet\pmtopagents\test.php:1) in e:\Internet\pmtopagents\test.php on line 3 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at e:\Internet\pmtopagents\test.php:1) in e:\Internet\pmtopagents\test.php on line 3 but in my test.php is nothing else than: <?php session_start(); ?> there is no space in front of <?php where could be the error? best Link to comment https://forums.phpfreaks.com/topic/220242-session-error/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 30, 2010 Share Posted November 30, 2010 Since the session_start() statement is on line two of what you can see, but the error message indicates it is on line three in the file, you likely have a blank-line/new-line character on line one of your file. Link to comment https://forums.phpfreaks.com/topic/220242-session-error/#findComment-1141362 Share on other sites More sharing options...
neugi Posted November 30, 2010 Author Share Posted November 30, 2010 Hi, could it be that apache is adding a newline? i'm shure that there is no newline char in front of my code and there is also no other include in the thest files. in the test file there are only 3 lines (see top, nothing else) best Link to comment https://forums.phpfreaks.com/topic/220242-session-error/#findComment-1141364 Share on other sites More sharing options...
BlueSkyIS Posted November 30, 2010 Share Posted November 30, 2010 I see an empty line on line 1 before your open tag <?php, making session_start() line 3. the only time I have had session_start() fail when it was REALLY the first thing in the file, i had to save the PHP file as UTF-8 with NO BOM. Link to comment https://forums.phpfreaks.com/topic/220242-session-error/#findComment-1141366 Share on other sites More sharing options...
PFMaBiSmAd Posted November 30, 2010 Share Posted November 30, 2010 IF (a big if) the error indicated that the session_start() in your posted code was on line 2, I would agree that you don't have any new-line in your file before the <?php tag. However, the error message does not lie. I recommend that you open your file and back-space to the start of the file and the hit the delete key until the < character on the <?php tag is removed to make sure you don't have any characters before the <?php tag. Link to comment https://forums.phpfreaks.com/topic/220242-session-error/#findComment-1141369 Share on other sites More sharing options...
neugi Posted November 30, 2010 Author Share Posted November 30, 2010 got the error, fucking notepad on windows is making a space in front of the code, but it don't shows it in the editor, changing now to notepadd++ thx Link to comment https://forums.phpfreaks.com/topic/220242-session-error/#findComment-1141370 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.