Portal Home > Knowledgebase > Articles Database > Cannot send session cookie - headers already sent


Cannot send session cookie - headers already sent




Posted by 333halfevil, 12-31-2009, 09:36 PM
Hi everyone. I am having trouble with this php. Any help is appreciated. Thanks I keep getting these errors: Here is a the code:

Posted by someone150, 01-01-2010, 07:35 AM
session_start(); must be before any other output (html).

Posted by foobic, 01-01-2010, 07:38 AM
You need to finish setting up your session data before anything goes out to the browser. So put all your form processing code in before that initial "

Posted by someone150, 01-01-2010, 08:03 AM
Actually, you just need to put session_start(); before other output. Session data can be set even after output, because they are on server side. Another option is to use ob_start(); before session_start(); which allows you to set cookies, use header("Location: /"); anywhere in code.

Posted by 333halfevil, 01-01-2010, 10:08 AM
Thank you for your help What a co-incidence exactly at the same time haha I'm still having trouble with this though. After looking through it I could find nothing missing?

Posted by Neseema M M, 01-02-2010, 01:05 AM
I too cannot find any error there. Anyway change the quotes in the $_SERVER array and put it correctly so that PHP_SELF got printed in red color . I think it may cause the problem.

Posted by 333halfevil, 01-02-2010, 02:46 AM
Thank you very much. It is now fixed



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Global Load Balancing (Views: 806)
default template (Views: 818)
SingleHop Down? (Views: 813)


Language:

LoadingRetrieving latest tweet...

Back to Top Copyright © 2018 DC International LLC. - All Rights Reserved.