Gaming World Forums

General Category => Technology and Programming => Topic started by: IceSage on January 05, 2008, 03:22:23 pm

Title: PHP (MediaWiki) Cannot modify header
Post by: IceSage on January 05, 2008, 03:22:23 pm
Well, I was screwing around with the main index.php file. I added a piece of code, ran the script. I got this error:


Warning: Cannot modify header information - headers already sent by (output started at /home/content/i/c/e/icesage1984/html/drequiem/drwiki/index.php:2) in /home/content/i/c/e/icesage1984/html/drequiem/drwiki/includes/OutputPage.php on line 570

Warning: Cannot modify header information - headers already sent by (output started at /home/content/i/c/e/icesage1984/html/drequiem/drwiki/index.php:2) in /home/content/i/c/e/icesage1984/html/drequiem/drwiki/includes/OutputPage.php on line 571

I removed the line and put the file exactly how it was... And, I STILL get this error.

I know a little PHP, I'm just not savvy when it comes to figuring out the most basic of errors from other peoples scripts.

Any help would be appreciated.
Title: PHP (MediaWiki) Cannot modify header
Post by: dom on January 05, 2008, 03:31:39 pm
You might have accidentally put some whitespace at the top of the page.

If not, upload the file somewhere and we can check it out
Title: PHP (MediaWiki) Cannot modify header
Post by: losl on January 05, 2008, 04:00:17 pm
Because of the way HTTP headers work, you get that error whenever you "echo" or "print" anything to the browser.

You see, because when you type in an adress, you send a series of http headers explaining what you are asking the server for. The server then replies with its own series of headers and then the content of the page. PHP allows you to manually send certain headers, but as soon as you send any output, php no longer lets you send any headers, because they will no longer work, and are likely to confuse your browser.

There are work arounds for this, using the ob functions (php.net/ob_start). But more than likely what you need to do is hunt down an "echo", "print", or "print_r"
Title: PHP (MediaWiki) Cannot modify header
Post by: IceSage on January 05, 2008, 05:51:34 pm
Thanks for the explaination, Losl.

And, it was the one line of whitespace I had. >_>

Thanks for the replies you two.