Question:
php problem. Can someone Help PLEASE?
?
2009-07-15 08:29:03 UTC
Hey everyone can someone please help me I keep getting this error and I have no Idea how to fix it.

[phpBB Debug] PHP Notice: in file session.php on line 1006: Cannot modify header information - headers already sent by (output started at 2.php:7)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1006: Cannot modify header information - headers already sent by (output started at 2.php:7)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1006: Cannot modify header information - headers already sent by (output started at 2.php:7)
Four answers:
Abimaelrc
2009-07-15 08:34:21 UTC
You need to make sure that all the session.php are in the first part of the page. All the header() must be in the first line or make sure that you didnt send something to the browser before the header() part. Check this for more info

http://www.php.net/manual/en/function.header.php
just "JR"
2009-07-15 08:39:37 UTC
This error comes frequently when a coder tries to use the function "headers()", when at least ONE character has already be sent to the user.

You file "session.php" has its error on line 1006, which is very, very far down!

Search for ANYTHING that creates an "output":

ie: echo("text") leads to an output. You can't use headers() after that.

The most common error is a single blank line in the code:

1.
2.

3. $Session = md5()

4. headers(something)

will generate that error: line 2! (there is nothing, sure, but there is a couple CR/LF!

(And I think it is your mistake => "(output started at 2.php:7)" !
walmeis
2009-07-15 08:34:16 UTC
It means there is a header() call somewhere after the headers have already been concluded. Move the header() call(s) upward before any page text is sent, particularly before
RM
2009-07-15 08:33:33 UTC
Its hard to know without seeing your code but it looks like you have an echo before a header statement. Header statements must be before all outputs.



WRONG:

echo 'hello!!';

header('index.php');



RIGHT:

header('index.php');

echo 'hello!!';


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...