Re: don't want to belabor a point about session_start, but...

From: Date: Thu, 29 Jan 2004 23:35:55 +0000
Subject: Re: don't want to belabor a point about session_start, but...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-176275@lists.php.net to get a copy of this message
Rachael Laporte Taylor wrote:
OK, I understand that in order to avoid those nasty warning messages about "Cannot send session cookie - headers already sent...." you must include the directive, session_start, above all headers, includes, etc. I'm trying to debug and port a contractor's code to PHP 4.3.4 from a couple of years ago. Is there an explanation as to why the code, written under PHP 3 and also working under PHP 4.0.4, would not generate these warning messages, without having session_start at the top of the file? The session_start directive is pulled in later with an include file.
The truth of the matter is that you *can* do a session_start below other headers and such, but you have to be using output buffering. In addition, it is quite possible to do lots of including and processing before you do a session_start()...just as long as you don't do any output. Is the contractor's code outputting before that include? -- paperCrane <Justin Patrin>

« previous php.general (#176275) next »