Hello everyone, I put in an include_once "file.inc", but I get this warning about 10 times: Warning: Cannot modify header information - headers already sent by (output started at /home/content/f/r/e/freepr0xy/html/PHProxy.class.php:151) in /home/content/f/r/e/freepr0xy/html/PHProxy.class.php on line 934 Why is this and how can I fix it or turn of php warnings? Thanks
You are sending some output to the browser before the headers are outputted. The headers should be the first things to be outputted to the browser. Try fixing the above or add ob_start(); right at the top of your script and ob_flush(); at the bottom.
dave487, could you give more details? You mean right after the <? php part? So it would look like <?php ob_start(); bla bla bla bla ob_flush(); ?> What does this do?
Move file.inc down below where the first headers are printed. Where depends on the rest of the script. http://uk.php.net/ob_start
And the way I put it would be correct? Does it work with any php script? I am getting this error also and would like to try the fix
take a look in PHProxy.class.php at line 151 and see what is sent to the browser, some spaces, maybe an empty row or something.
Perhaps there's an empty line or space at the bottom of the script, below or behind the ?>. Get rid of that empty space or line and try again. Most of that problems are caused by lousy text editors which add an empty line at the end.
The way you put it is correct and it works with any php script as far as I know. Not entirely sure what it does - the only noticeable effect for me is that the error message disappears
When you use ob_start(), the output content is stored in an internal buffer rather than sending it to the client. If you use ob_end_clean() the buffer is emptied. And if you use ob_end_flush() it sends out what the buffer had, to the browser. You can read more about it at the link specified by T0Ps ..
I am having this problem too but none of your above solutions are working for me. Anybody know why? http://joshyd.dansgalaxy.co.uk
Sometime the error is one or two rows above or below the actual line displayed, depends where an array starts, some others headers are sent twice, once in an included file and once inside the main script so I would look at that too. Adding error_reporting(0); in the first line after <?php turns off errors, but if your script can't be executed due to such error, like occurs with that of JoshyD, you will get a blank page instead of stop printing errors.
the problem is in your index.php at line 2 or 1. remove any blank spaces or blank rows above opening tag <?php Also , post the first lines of your index.php file.