note 45189 deleted from function.session-start by tomsommer
| From: | tomsommer@php.net | Date: | Sat, 28 Aug 2004 22:58:18 +0000 |
| Subject: | note 45189 deleted from function.session-start by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75511@lists.php.net to get a copy of this message | ||
Note Submitter: Azzerhoden at yahoo dot com
----
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. :-)