January 6, 201115 yr Hey, Im getting the below error, how can i get around this? Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /#####/#####/#####/functions.php:3) in /#####/#####/#####/functions.php on line 11 Thanks,
January 6, 201115 yr Basically means exactly what it says... that headers have already been, so you cant send any more. The error is stating that line three of functions.php has already sent the headers to the browser. It could be whitespace in an include file or you're already outputting data to the browser.
January 6, 201115 yr This means you've already written some body content to the response before you called session_start(). As it routinely affects the headers (which are submitted before the body), it should appear near the beginning of your script. Even if you haven't written content explicitly before the session_start() call, look out for white space outside <?php ... ?> tags etc., as the whitespace can be written to the body too. I tend to structure scripts as: <?php // includes and requires which don't output anything session_start(); // rest of script ?> Does that solve it for you? Edited January 6, 201115 yr by Connetu_C
January 7, 201115 yr This means you've already written some body content to the response before you called session_start(). As it routinely affects the headers (which are submitted before the body), it should appear near the beginning of your script. Even if you haven't written content explicitly before the session_start() call, look out for white space outside <?php ... ?> tags etc., as the whitespace can be written to the body too. I tend to structure scripts as: <?php // includes and requires which don't output anything session_start(); // rest of script ?> Does that solve it for you? Actually this <?php // includes and requires which don't output anything session_start(); // rest of script ?> Would cause errors cause u have spaces before the session start which is also considered output. EDIT: actually i should stress this would just be the case if theres a space before <?php but useful info just the same Edited January 7, 201115 yr by webdesigner93
January 10, 201115 yr Yep, working with session stuff at the moment and I try to make sure that session_start(); is the first line of all my PHP session scripts.
Create an account or sign in to comment