-1

Possible Duplicate:
“Warning: Headers already sent” in PHP

I'm getting an error:

   Warning: Cannot modify header information - headers already sent by (output started at /home/content/52/5148252/html/ruhuna/common/header.php:8) in /home/content/52/5148252/html/ruhuna/login.php on line 115

I know error is caused by white space but I couldn't find any blank space in my files. Therefore I added ob_start() to my header.php and the problem went away.

Am I likely to encounter any problems due to adding ob_start?

I didn't use ob_flush(), is that going to cause any problems?

If so, where would I need to add ob_flush()"

Community
  • 1
  • 1

2 Answers2

0

Just took a look at your code. when you change header information, you can't have any thing outputted to the site before you try to change header information. this includes any HTML, etc. You have HTML before trying to change the header, this is what the problem is.

kennypu
  • 5,950
  • 2
  • 22
  • 28
  • So friend,how did i solve that problem? – Steven Holzner Dec 07 '12 at 01:57
  • 1
    when you use ob_start(), nothing is outputted, including HTML, etc. they are just stored in an internal buffer, then outputted later. Since you don't have anything outputted yet, you were able to change header information. – kennypu Dec 07 '12 at 02:01
0

ob_start() is safe. Sometimes if you have a very long-running script it would be better if the user could see some output as the script progresses, which ob_start() will stop from happening. But that is not normally a problem.

Rimu Atkinson
  • 775
  • 4
  • 15