TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   Sessions (http://www.talkphp.com/advanced-php-programming/5009-sessions.html)

captainmerton 10-08-2009 10:16 AM

Sessions
 
I have developed a website on my laptop using php5 and recently moved it to a hosted environment. I now keep getting loads of errors around session handling such as "Cannot send session cache limiter - headers already sent". I corrected a few by removing spaces from the bottom of php scripts after the ?> php end command however they are everywhere and i never got any issues like this on my laptop. Both the laptop and the shared hosting environment are php5 but probably different versions. Any idea why this wasnt a problem on my laptop can I suppress this errors or something?

Village Idiot 10-08-2009 06:19 PM

"headers have already been sent" means that output has been sent to the client. Cookies, meta data, sessions and things of that sort can not be modified after the output has already been sent. Make sure that anything which modifies it is before the first bit of output.

I tend to avoid sessions, they are too often unreliable, especially in larger environments that are not managed by pros.

ioan1k 10-08-2009 08:57 PM

Code:

?>
A good practice to follow is to exclude this from your code, to avoid future problems such as this one ...

And the error should include where the data is being sent ( File & Line ) before the session is started

captainmerton 10-09-2009 10:46 AM

What do you mean by "exclude this from your code"?

ETbyrne 10-09-2009 01:00 PM

He means take the ending PHP tag out of your PHP files. This prevents you from accidentally having white space after the ending tag that ends up getting output to the screen.


All times are GMT. The time now is 10:22 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0