...

View Full Version : confusing wordpress error



lmorales
08-14-2012, 07:04 PM
Any idea what this error means? Im working on redoing my website, using this reallyyyy gorgeous template I found, but wordpress keeps giving me this warning


Warning: Cannot modify header information - headers already sent by (output started at /home/content/58/8802958/html/wp-content/themes/Retro/haku/functions.php:1) in /home/content/58/8802958/html/wp-includes/pluggable.php on line 881



my site is at coy-design.com

VIPStephan
08-15-2012, 12:25 AM
That means that in functions.php you have some kind of text/HTML output where it shouldn’t be because PHP is supposed to modify document header information which must happen before any output.

Fou-Lu
08-15-2012, 12:29 AM
And its super nice and easy.
You either have a space on the first line (or other output perhaps?), or you have BOM prior to <?php on your functions script (denoted in the error as :1). Make sure you open in a plaintext editor such as notepad or vim, and save it back under ansi if you don't see a whitespace preceding the <?php. Don't save it in unicode.

lmorales
08-15-2012, 04:07 PM
That worked! Thanks so much, quick question, I never saw an actual space, so I saved it under ansi as you suggested, why does that mess everything up?

Fou-Lu
08-15-2012, 04:18 PM
That worked! Thanks so much, quick question, I never saw an actual space, so I saved it under ansi as you suggested, why does that mess everything up?

Unicode adds byte order markers that are not rendered in the document itself. Depending on the charset in use, unicode specifies 2 to 4 hex characters at the start of the text document to indicate what endian it uses, and are not treated as actual text (and are therefore illegible). Its fixed by opening and saving in a plain text editor with ansi, and sometimes you may need to go back in and remove the characters at the front of the document.

BOM themselves don't damage PHP. It treats it as output text to the document, and HTML decides what to do with it. If it can render it, it will, otherwise it will ignore them. Problem in PHP comes to anything that requires the use of a header, so a direct call to headers, cookies, sessions, etc. Now it has output prior to the header call, which will force PHP to issue a warning since it's now incapable of pushing more information to the header stack. As soon as any output is present, it must flush the headers first, and then send that output to the client. There is no way to go back after headers are sent to queue more up.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum