note 37989 added to function.session-start

From: Date: Wed, 03 Dec 2003 22:17:05 +0000
Subject: note 37989 added to function.session-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-61367@lists.php.net to get a copy of this message
I was modifying a registration script today. I had 2 copies running, because one was being modified and the other contained the original code that I would use as reference. With the script I was modifying however, I kept getting: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\Apache\Apache2\site\test\test\registration_p.php:2) in c:\Apache\Apache2\site\test\test\vdaemon.php on line 78 I tried everything I knew of. I tried to destroy the session before it started, I copied the script I was calling (which also made the session) and renamed it. Nothing worked. Then, I noticed one small difference in the two scripts. There was a single carriage return on the top line before I started my <?php ?>. I removed it and everything worked just like it should. Moral of the story: Never have extra lines where they aren't needed. Frankly, I'd like to know why it would do that just because of one empty line. ---- Manual Page -- http://www.php.net/manual/en/function.session-start.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37989 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37989&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37989&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#61367) next »