Re: [PHP4BETA] session_start() and headers
| From: | Evan Klinger | Date: | Wed, 01 Dec 1999 06:02:08 +0000 |
| Subject: | Re: [PHP4BETA] session_start() and headers | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-7154@lists.php.net to get a copy of this message | ||
Roberto Diaz wrote:
>
> Hi!
>
> Well I have some code that the very first thing it does is to call
> session_start(), so at the beggining it puts a cookie (I have sessions
> configured with cookies)..
>
> Then I want to send html but I recieve this error (and at times i dont
> depending of the browser..
>
> Warning: Cannot add header information - headers already sent in
> /usr/local/apache/htdocs/main.php on line 7
>
> It seems only a warning but in fact the browser (Netscape Communicator
> 4.61 in this case) dont recieve any cookie from the server so the session
> is created but the client always seems to be a new one and dont recieve
> the session objects.. I know I have to put a cookie before anything else
> but I dont know how does session_start().
>
> Please help.. and be patient.
>
> This is the problematic code (so you can figure out)
>
> if(!isset($servinfoSession)){
> $servinfoSession = new servinfoSession();
> // since still an object **can not register itself**.##############
> session_register("servinfoSession");
> // ########################################################
> $servinfoSession->currentPage->printout(); // this outputs html
> exit();
> }
>
> Thank you very much
You are outputting HTML before you call the session() functions. Check
to make sure no <html> tags are being sent before the actual call, or
turn output buffering on.
--
ev
----------------------------
Evan Klinger evan@php.net
AIM evan715