session_start() and headers

From: Date: Wed, 01 Dec 1999 05:18:09 +0000
Subject: session_start() and headers
Groups: php.version4 
Request: Send a blank email to php-version4+get-7151@lists.php.net to get a copy of this message
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 Roberto

« previous php.version4 (#7151) next »