Page 1 of 1

session_start(), cannot send session cookie/cache limiter

Posted: Wed Mar 18, 2009 1:12 pm
by lomme47
Hi, after spending the whole day reading forums I still can't figure this out.
These are the error messages I get.

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at ####/httpd.www/test.php:1) in ####/httpd.www/test.php on line 1

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at ####/httpd.www/test.php:1) in ####/httpd.www/test.php on line 1

2 files:

index.html

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>sdfsdf</title>
</head>
<body>
 
<a href="test.php">test</a>
 
</body>
</html>
test.php

Code: Select all

<?php session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
I click the Test link and the error occurs.

There's no linebreak, space or any other character before the php-tag, I checked in dreamweaver, notepad and eclipse.
(I saved both files as UTF-8 in notepad and the charsets are set to UTF-8 as you can see in the code)

So I figured I had to save the files as UTF-8 without BOM. I used dreamweaver for this but that didn't help.
So now I'm out of options.

Any help would be appriciated.
Enlighten me please :D

Re: session_start(), cannot send session cookie/cache limiter

Posted: Wed Mar 18, 2009 1:19 pm
by atonalpanic
This works for me just how you typed it. There is probably a micconfigured setting in your php.ini
I suggest you read http://us.php.net/manual/en/function.header.php under the 'Notes' section.

Re: session_start(), cannot send session cookie/cache limiter

Posted: Wed Mar 18, 2009 1:24 pm
by lomme47
Yeah I guess it's something like that. the site is at http://www.one.com and I'm still waiting for an answer from them. Any suggestions on what I should be looking for inside php.ini?

Re: session_start(), cannot send session cookie/cache limiter

Posted: Wed Mar 18, 2009 1:36 pm
by atonalpanic
Try output buffering as a temporary solution. I'm not sure what can cause this right of the top of my head.

Re: session_start(), cannot send session cookie/cache limiter

Posted: Wed Mar 18, 2009 1:51 pm
by php_east
they aren't exactly error mesages, they are just warnings. the host probably has another script going before you do. maybe for advert purposes.