Take the 2-minute tour ×

Yesterday I saw a grammar mistake on my page, then I connected via FTP to the web server and I edited the index.php file (where I saw the mistake), I corrected one single word in the middle of the page, then I saved it. I refreshed the page and I saw the following warning message at the top of the page:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at ../index.php:1) in /home/../public_html/../index.php on line 2

Ok, I know what it means, the header was already sent. I have no white spaces, no includes, nothing in front of the session_start(). I put ob_start() in the front of the function session_start(), but I get the same warning message.

The irony of it all is that I didn't edit nor modify the session_start() function, I did not put anything there. I only corrected one single character in the middle of the page, and I get this warning message.

I don't know what should I do. Can anyone help me? Suggestion please!

Thank you!

share|improve this question
post your code samples. –  Steven1978 Jul 2 '12 at 9:00
The first thing that pops to mind is that there may be a UTF-8 BOM in the beginning of the file. Make sure you save it as UTF-8 without BOM if you save it as UTF-8 on Windows. –  Corbin Jul 2 '12 at 9:01
add comment

3 Answers

up vote 4 down vote accepted

There might be a Byte Order Mark that causes output to be sent. PHP doesn't know about the BOM, and just treats it as output, which gets sent to the browser.

Save the file as utf-8 without BOM to solve this issue.

share|improve this answer
add comment

Is the FTP client PC a Windows PC and is the PHP file saved as UTF-8? The editor may have prepended the BOM, which PHP doesn't understand. You can remove this using a hex editor and removing the first three bytes, or save the file again in an editor that doesn't prepend the BOM, for example Notepad++.

share|improve this answer
add comment

Obviously, you have some output sent to the browser in index.php in line 1, prior to call to session_start. Check line 1 of index.php for spaces etc.

THe most likely reason is that you've edited index.php with some Windows text editor, which, for some reason, thought your file is in UTF-8 encoding and placed a BOM in its beginning. PHP does not process BOM in any special way, so these bytes went straight to the browser, causing headers end.

share|improve this answer
add comment

Your Answer


