i am getting Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at error
<Generally this error arise when we send header after echoing or printing. If this error arise on a specific page then make sure that page is not echoing anything before calling to start_session().
Example of Unpredictable Error:
<?php //a white-space before <?php also send for output and arise error
session_start();
session_regenerate_id();
//your page content
One more example:
<?php
includes 'functions.php';
?> <!-- This new line will also arise error -->
<?php
session_start();
session_regenerate_id();
//your page content
Conclusion: Do not output any character before calling session_start() or header() functions not even a white-space or new-line
use ob_start();
before session_start();
at top of your page like this
<?php
ob_start();
session_start();
Just replace session_start with this.
if (!session_id() && !headers_sent()) {
session_start();
}
You can put it anywhere, even at the end :) Works fine for me. $_SESSION is accessible as well.
use session_start()
at the top of the page.
for more details please read the link session_start
Check any extra space before php tag.
I had a website transferring from one host to another, it seemed to work fine on the old host but a few pages on the new host threw the error
Warning: session_start(): Cannot send session cache limiter - headers already sentwhile I always kept the
<?php session_start();
at the top of the page no spaces and nothing inserted before
it really bugged me that I stared every page with the session opening, and it worked on some pages and run through a bug on others I picked the pages that had the problems, backed them up, created new blank pages and simply copied and pasted the code as is, saved and uploaded and boom, problem gone!
this is something you guys may need to consider, it may have been the encoding of the page, or something, not sure the exact source of the problem, but here is a fix to look at in case you guys run into a similar problem
cheers!