note 45189 added to function.session-start

From: Date: Sat, 28 Aug 2004 21:33:25 +0000
Subject: note 45189 added to function.session-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-75508@lists.php.net to get a copy of this message
Just figured out a bug that was appearing on some of my PHP web pages. The message is: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/localhost/htdocs/player_ogcs.php:2) in /var/www/localhost/htdocs/player_ogcs.php on line 4 Code causing the issue was: <?php // Restart the session for global variables session_start(); ... ?> Yet other pages that started the same way did not cause the warning. <?php // Restart the session for global variables session_start(); ... ?> The issue? The blank line above <?php ... ?> Remove the blank line so the first line in the page is <?php ... ?> and the warning will disappear. I am sure there is a logical reason for this, but I am too busy beating my head agaisnt the wall to look for it. :-) ---- Manual Page -- http://www.php.net/manual/en/function.session-start.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45189 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45189&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45189&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#75508) next »