Sessions question

A

Anonymous

Guest
well what does the error say .. Cannot send session cookie - headers already.. that's exactly what it means. you ask when are the headers sent.. well as soon as you output something to the browser.. ANYTHING even a space.
 
Since Redcircle's reply wasn't exactly illustrative, I'll clarify.

You cannot use the header() function (or cookie or session functions) after you have sent output to the browser. Output includes anything, be it, text, HTML, whitespace, or PHP echo/print statements, or even errors. All functions which modify the headers (i.e. header()) must be called before any output is sent to the browser.
 
Everything already explained !!

Now replace your header("Cache-control: private"); line with session_cache_limiter('private');

Cheers
 
Back
Top