This question already has an answer here:
I have written <?php session_start(); ?>
above everything in all pages. Some pages are rendering fine but I am getting this error in other pages. I have checked and matched each page code and code is fine. If I remove <?php session_start(); ?>
then page renders fine but I need to use session.
Cannot send session cache limiter - headers already sent (output started at /home/) in ...
One thing to note is: It runs fine on my local server.
</div>
I would bet it's one of two things:
Make sure there is no output, including newlines, in your file before you call session_start
. PHP must send HTTP headers first (before the message body, i.e. page content), so trying to send a header after you've already sent page content will give you that error.
You should only call session_start
only once per page. If you're using include
in a file after you've called session_start
, make sure you're not calling session_start
again in the included file. This would cause the "headers already sent" error.
you have some output (maybe an whitespace) in one of your included files.
maybe your <?php
is not the very first of your file somewhere.
You could also try to use output buffering (http://php.net/manual/es/function.ob-start.php). I'd first check to see whether you are not sending any output by mistake (as @steven suggests), but still, it might be a good idea for you to buffer your outputs.
Since you are including multiple files, and you seem to have a session_start()
in multiple files, I bet the error is thrown in the second file.
Check all files for the session_start()
, and for whitespace before any of these are called.
This is a very typical BOM header problem. I suspect that your editor stored a UTF-8 BOM header with 3 bytes 
at the begin of the file. The editor will hide them, so if you are not sure if your file contains these characters, you can either use a non interpreting editor (hex editor), or this wonderful online W3C checker.