Page 1 of 1

Problem Cannot send session cache limiter - headers already

Posted: Sun Feb 07, 2010 3:02 am
by Lobsterbob
Hello everyone,
I am pretty new to PHP and need some help. I hope someone has the anwser for me. Its driving me nuts. :banghead: I am building a login form and get this error message:


Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /usr/home/brietjens3/domains/finnianlegal.nl/public_html/login2.php:5) in /usr/home/brietjens3/domains/finnianlegal.nl/public_html/login2.php on line 6

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/brietjens3/domains/finnianlegal.nl/public_html/login2.php:5) in /usr/home/brietjens3/domains/finnianlegal.nl/public_html/login2.php on line 8


I did some research and found that often the problem is that there is something that is sent to the browser before the session starts. So I deleted all extra space, lines, echos, prints, but it was still giving me this problem. To identify the problem I have completely stripped my scripped to just the HTML basic tags and the sessiop, and it is still giving the same error. :crazy: This is what the code looks like:

Code: Select all

<html>
<head>
</head>
<body>
<?php 
session_start();
$_SESSION['name'] = "bob";
header("Location: admin.php");
?>
</body>
</html>
The file is encoded: UTF-8 without BOM

Someone please help! Thanks in advance. (english is not my first language, so my apologies for any mistakes unclearities)

Greetings from Amsterdam,
Bob


Re: Problem Cannot send session cache limiter - headers already

Posted: Sun Feb 07, 2010 3:45 am
by Luke
The HTML tags you are outputting before the header are your problem. Not sure what you think "output" is, but it is ANYTHING that is sent to the browser.

Also, when posting code in the forums, please use

Code: Select all

code blocks. I have edited your post to reflect how we'd like to see it posted in the future. Thanks