By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,640 Members | 2,118 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,640 IT Pros & Developers. It's quick & easy.

headers already sent ...

P: n/a
My host doesn't use buffering so I placed the form validation (php) ahead of
the html like this:

<?php
if(isset($_POST['dn])) {
<do the validation processing>
if(file_exists($fn)) {
header("Location: $fn"); <---Bombs
}
}
include('./dlheader.inc'); // this provides the <HEAD> html script
?>
<form name="form1" method="post" action=<?php echo $_SERVER['PHP_SELF']; ?>"
......
The script works good on my machine with Apache/PHP, but on the host which
uses Apache/PHP, it states that the headers have already been sent (when it
gets to <---Bombs header). I can't understand it. Any help on this would
certainly be appreciated.


Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Is there anything before the <?php at the start of the document? A single
line feed or space would be considered content and sent to the client before
your header.

- Kevin

"Douglas F." <ra****@nospamicom.net> wrote in message
news:1103647001.3947e812e85d4e3bc44883eda231d879@t eranews...
My host doesn't use buffering so I placed the form validation (php) ahead
of
the html like this:

<?php
if(isset($_POST['dn])) {
<do the validation processing>
if(file_exists($fn)) {
header("Location: $fn"); <---Bombs
}
}
include('./dlheader.inc'); // this provides the <HEAD> html script
?>
<form name="form1" method="post" action=<?php echo $_SERVER['PHP_SELF'];
?>"
.....
The script works good on my machine with Apache/PHP, but on the host which
uses Apache/PHP, it states that the headers have already been sent (when
it
gets to <---Bombs header). I can't understand it. Any help on this would
certainly be appreciated.

Jul 17 '05 #2

P: n/a
On Tue, 21 Dec 2004 11:38:54 -0500, "Douglas F." <ra****@nospamicom.net> wrote:
My host doesn't use buffering so I placed the form validation (php) ahead of
the html like this:

<?php
if(isset($_POST['dn])) {
<do the validation processing>
if(file_exists($fn)) {
header("Location: $fn"); <---Bombs
}
}
include('./dlheader.inc'); // this provides the <HEAD> html script
?>
<form name="form1" method="post" action=<?php echo $_SERVER['PHP_SELF']; ?>"
.....
The script works good on my machine with Apache/PHP, but on the host which
uses Apache/PHP, it states that the headers have already been sent (when it
gets to <---Bombs header). I can't understand it. Any help on this would
certainly be appreciated.


What's the full error message? It tells you what line started the output that
caused headers to be sent.

For example:

Warning: Cannot modify header information - headers already sent by (output
started at /home/andyh/public_html/test.php:2)

(Generally you should always post the exact text of errors rather than
paraphrasing them)

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #3

P: n/a
Cannot modify header information, headers already sent by(output started at
/home/../download.php.2) in /home/../download.php on line 82

"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:76********************************@4ax.com...
On Tue, 21 Dec 2004 11:38:54 -0500, "Douglas F." <ra****@nospamicom.net> wrote:
My host doesn't use buffering so I placed the form validation (php) ahead ofthe html like this:

<?php
if(isset($_POST['dn])) {
<do the validation processing>
if(file_exists($fn)) {
header("Location: $fn"); <---Bombs
}
}
include('./dlheader.inc'); // this provides the <HEAD> html script
?>
<form name="form1" method="post" action=<?php echo $_SERVER['PHP_SELF']; ?>".....
The script works good on my machine with Apache/PHP, but on the host whichuses Apache/PHP, it states that the headers have already been sent (when itgets to <---Bombs header). I can't understand it. Any help on this wouldcertainly be appreciated.
What's the full error message? It tells you what line started the output

that caused headers to be sent.

For example:

Warning: Cannot modify header information - headers already sent by (output started at /home/andyh/public_html/test.php:2)

(Generally you should always post the exact text of errors rather than
paraphrasing them)

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool

Jul 17 '05 #4

P: n/a
On Tue, 21 Dec 2004 12:27:17 -0500, "Douglas F." <ra****@nospamicom.net> wrote:
"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:76********************************@4ax.com.. .
On Tue, 21 Dec 2004 11:38:54 -0500, "Douglas F." <ra****@nospamicom.net>

wrote:
<?php
if(isset($_POST['dn])) {
<do the validation processing>
if(file_exists($fn)) {
header("Location: $fn"); <---Bombs
}
}

The script works good on my machine with Apache/PHP, but on the host
which uses Apache/PHP, it states that the headers have already been sent (when
it gets to <---Bombs header). I can't understand it. Any help on this
would certainly be appreciated.


What's the full error message? It tells you what line started the output
that caused headers to be sent.


Cannot modify header information, headers already sent by(output started at
/home/../download.php.2) in /home/../download.php on line 82


OK, then what's on line 2 of the real code you're running? (The code you
posted wouldn't even parse, particularly line 2).

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #5

P: n/a
I'll be darn. I deleted the blank space above <?php and it worked. I guess
you were right about no blank spaces above the code. It didn't occur to me
that something like that would cause something to hang. Usually, all blanks
are parsed out in compilers, etc.. Thanks a lot.

"Kevin" <ke***@wxREMOVE4SPAM3.com> wrote in message
news:4nYxd.267476$HA.55784@attbi_s01...
Is there anything before the <?php at the start of the document? A single
line feed or space would be considered content and sent to the client before your header.

- Kevin

"Douglas F." <ra****@nospamicom.net> wrote in message
news:1103647001.3947e812e85d4e3bc44883eda231d879@t eranews...
My host doesn't use buffering so I placed the form validation (php) ahead of
the html like this:

<?php
if(isset($_POST['dn])) {
<do the validation processing>
if(file_exists($fn)) {
header("Location: $fn"); <---Bombs
}
}
include('./dlheader.inc'); // this provides the <HEAD> html script
?>
<form name="form1" method="post" action=<?php echo $_SERVER['PHP_SELF'];
?>"
.....
The script works good on my machine with Apache/PHP, but on the host which uses Apache/PHP, it states that the headers have already been sent (when
it
gets to <---Bombs header). I can't understand it. Any help on this would certainly be appreciated.


Jul 17 '05 #6

P: n/a
.oO(Douglas F.)
I'll be darn. I deleted the blank space above <?php and it worked. I guess
you were right about no blank spaces above the code. It didn't occur to me
that something like that would cause something to hang. Usually, all blanks
are parsed out in compilers, etc.. Thanks a lot.


That's simply the way it works. Everything(!) outside a <?php ... ?>
block is sent as-is to the client. After all that's what makes it
possible to embed PHP into a HTML document. But sending content back to
the client requires to send the headers first ...

Micha
Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.