Session (maybe cookies)
| From: | Rolf van de Krol | Date: | Tue, 03 Feb 2004 18:44:20 +0000 |
| Subject: | Session (maybe cookies) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-176711@lists.php.net to get a copy of this message | ||
Hi all,
I tried to start a session by this code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php session_start();
echo(session_id());
?>
</body>
</html>
When I execute it I got the following error:
Warning: session_start(): Cannot send session cookie - headers already sent
by (output started at e:\rolf\sites\thinkquest\sessiontest.php:9) in
e:\rolf\sites\thinkquest\sessiontest.php on line 9
Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at e:\rolf\sites\thinkquest\sessiontest.php:9)
in e:\rolf\sites\thinkquest\sessiontest.php on line 9
e183565b226d52b334b792e4b367221c
These are the headers which my browser sended:
GET http://localhost/sessiontest.php HTTP/1.0
Accept: */*
Accept-Language: ie-ee,nl;q=0.7,is;q=0.3
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Host: localhost
Proxy-Connection: Keep-Alive
And these are the headers which Apache returned:
HTTP/1.1 200 OK
Date: Tue, 03 Feb 2004 18:38:40 GMT
Server: Apache/1.3.28 (Win32) PHP/4.3.3
X-Powered-By: PHP/4.3.3
Connection: close
Content-Type: text/html
Does anybody know why these errors occurs??
Waiting for answer,
Rolf van de Krol