Page 1 of 1

session problem.

Posted: Mon Dec 28, 2009 10:28 am
by awdhut
The following message is appearing with o/p.
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/hope/public_html/dnb1.php:1) in /home/hope/public_html/dnb1.php on line 3.

1) I'm using UTF-8 collation in database.
2) I put session start function at top of document.
3) I tried ob_start("ob_gzhandler") Function.
4) I saved my document in utf-8 excluding BOM.
5) i'm using Session variable to transfer tha data from one file to another.
I tried all possibilities which i know.
I get the required o/p BUT the above message is appearing on the top of o/p.
How can i remove the msg.
Help me.

Re: session problem.

Posted: Mon Dec 28, 2009 11:01 am
by manohoo
Post your code, if you require or include files, also post that code.

Re: session problem.

Posted: Mon Dec 28, 2009 11:29 am
by Apollo
The session_start function creates a cookie. This must be done before outputting any HTML. Most likely you have already outputted something in your .php before you call session_start, so you gotta do it the other way round.

Note that this does not apply to reading or writing actual session variables, that's something 100% server side and can be done anywhere in the .php you want (well, after session_start, that is).

Re: session problem.

Posted: Mon Dec 28, 2009 9:09 pm
by ricky-ham
I had some of the same problems when I started to leran about the session and cookie. Like the comment above. Make sure that there is no output to the screen before your session. This will include any html or the doctype of the document.