note 108901 added to function.session-start
| From: | edibleDOTemailATgmailDOTcom | Date: | Sun, 03 Jun 2012 07:36:19 +0000 |
| Subject: | note 108901 added to function.session-start | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188376@lists.php.net to get a copy of this message | ||
If you are receiving errors like:
ERROR Warning: session_start() [function.session-start]: "Cannot send session cookie - headers
already sent by (output started at... "
...or...
"Warning: session_start(); [function.session-start]: Cannot send session cache limiter -
headers already sent".
...ensure that session_start(); is literally at the very top of your script, even before any DOCTYPE
declaration, eg:
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>...
...and, if using an included header file, ensure that the above approach is used in the header file,
with the header file request right at the top of the script that it is being called from, eg:
<?php
include '/var/header_file.php';
----
Server IP: 69.147.83.197
Probable Submitter: 78.129.220.46
----
Manual Page -- http://www.php.net/manual/en/function.session-start.php
Edit -- https://master.php.net/note/edit/108901
Del: integrated -- https://master.php.net/note/delete/108901/integrated
Del: useless -- https://master.php.net/note/delete/108901/useless
Del: bad code -- https://master.php.net/note/delete/108901/bad+code
Del: spam -- https://master.php.net/note/delete/108901/spam
Del: non-english -- https://master.php.net/note/delete/108901/non-english
Del: in docs -- https://master.php.net/note/delete/108901/in+docs
Del: other reasons-- https://master.php.net/note/delete/108901
Reject -- https://master.php.net/note/reject/108901
Search -- https://master.php.net/manage/user-notes.php