Page 1 of 1
trouble with header()
Posted: Sat Apr 23, 2005 8:58 pm
by anthony88guy
I get this error when I am trying to use header.
Warning: Cannot modify header information - headers already sent by (output started at /home/********/public_html/***********.php:30) in /home/******/public_html/********** on line 119
Posted: Sat Apr 23, 2005 9:00 pm
by John Cartwright
Hey ma, we got a tutorial for this.
viewtopic.php?t=1157
Posted: Sat Apr 23, 2005 9:01 pm
by Bennettman
You've already output HTML data. You should buffer it in some way (for example,
output buffering controls), or do something else to ensure that no output is sent to the browser before the header is sent.
Posted: Sat Apr 23, 2005 9:02 pm
by John Cartwright
That is a bandaid approach to the problem. Better yet, design your app's properly so that all your output is sent at the end of your program execution.

Posted: Sat Apr 23, 2005 9:08 pm
by Bennettman
Sometimes, bandaid is better (though I hate to say it ;p) than uprooting an existing script if it's practically done ^_-
But yeah, what Jcart said is absolutely right, it offers plenty of advantages in the end and is cleaner than constant output.
Posted: Sat Apr 23, 2005 9:59 pm
by anthony88guy
Ok thanks, so I need to add "ob_start()" in the beginning of the page and "ob_end_flush()" at the end. What’s bandaid? Writing script that takes less bandwidth?
Posted: Sat Apr 23, 2005 10:09 pm
by Bennettman
A bandaid approach is one where you apply quick fixes which don't make the code itself more effective, but do the job. Like putting on a bandaid/plaster when something goes wrong instead of stopping the problem from happening in the first place (or going to the trouble of preventing it happening again if it does).
Posted: Sun Apr 24, 2005 12:03 am
by anthony88guy
Bennettman wrote:A bandaid approach is one where you apply quick fixes which don't make the code itself more effective, but do the job. Like putting on a bandaid/plaster when something goes wrong instead of stopping the problem from happening in the first place (or going to the trouble of preventing it happening again if it does).
I feel dumb, it works now.