Headers already sent error
Hello,
I'm receiving an error "Cannot modify header information - headers
already sent by XXX".
In my php, I have a heap of code, then use header("Location: blah.php");
to redirect the user. I get this error on the webhost, but not on my
local host.
I've searched and found that this can be caused by spaces after the
closing php tag, but I don't have any.
What could this be?
Tim
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Headers already sent error
On Thu, 2005-02-03 at 12:59 +1030, Tim Burgan wrote:
> Hello,
>
>
> I'm receiving an error "Cannot modify header information - headers
> already sent by XXX".
>
> In my php, I have a heap of code, then use header("Location: blah.php");
> to redirect the user. I get this error on the webhost, but not on my
> local host.
>
> I've searched and found that this can be caused by spaces after the
> closing php tag, but I don't have any.
>
> What could this be?
>
>
> Tim
>
try adding:
ob_start();
to the top of your file
-Robby
--
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | robby [at] planetargon.com
* 503.351.4730 | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
* --- Now hosting PostgreSQL 8.0! ---
****************************************/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Headers already sent error
Tim Burgan wrote:
> Hello,
>
>
> I'm receiving an error "Cannot modify header information - headers
> already sent by XXX".
>
> In my php, I have a heap of code, then use header("Location:
> blah.php"); to redirect the user. I get this error on the webhost, but
> not on my local host.
>
> I've searched and found that this can be caused by spaces after the
> closing php tag, but I don't have any.
>
> What could this be?
>
>
> Tim
>
Rest assured, *something* is getting output before you try that header()
call. Anything outside of PHP tags (carriage rturns/line feeds/spaces)
any echo or print.
To help you figure it out, try doing something like exit('STARTOFBODY');
instead of the header call. Then view the source of the ouput and see
what precedes that
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Headers already sent error
Pls Make sure that outside your <?php and ?> tags, these is no any
blankspace or sth else.
Best regards,
Yang Shiqi
-----Original Message-----
From: Chris [mailto:listschris [at] leftbrained.org]
Sent: Thursday, February 03, 2005 3:44 PM
To: [php] PHP General List
Subject: Re: [PHP] Headers already sent error
Tim Burgan wrote:
> Hello,
>
>
> I'm receiving an error "Cannot modify header information - headers
> already sent by XXX".
>
> In my php, I have a heap of code, then use header("Location:
> blah.php"); to redirect the user. I get this error on the webhost, but
> not on my local host.
>
> I've searched and found that this can be caused by spaces after the
> closing php tag, but I don't have any.
>
> What could this be?
>
>
> Tim
>
Rest assured, *something* is getting output before you try that header()
call. Anything outside of PHP tags (carriage rturns/line feeds/spaces)
any echo or print.
To help you figure it out, try doing something like exit('STARTOFBODY');
instead of the header call. Then view the source of the ouput and see
what precedes that
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php