This question already has an answer here:
i have uploaded my project on the server but when i try to run it it shows this warning. However on my local machine every thing is working just perfect what could be the problem.
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/prosyst2/public_html/sms/index.php:1) in /home/prosyst2/public_html/sms/auth.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at /home/prosyst2/public_html/sms/index.php:1) in /home/prosyst2/public_html/sms/auth.php on line 8
</div>
You can't set session/cookie after you echo'd something or generated some output.
You can use ob_start();
at the beginning of the file and echo ob_get_clean();
at the end to buffer the output.
Your local php installation does not report warnings correctly, set it to report E_ALL
, which is errors, warnings, notices etc, and the other way on the server.
When it comes to your specific problem, you have output before your session_start();
call, this could be html or anything that writes to the output buffer, or incase session_start();
is on the top of the page, possibly a BOM
character.
How to fix:
Never do any output before sending headers (header(...)
, session_start()
etc) and this wont happen.
Always report all errors and warnings etc on a development installation, so you know whats wrong.