[pmwiki-users] Under attack

Lars Eighner surname at larseighner.com
Sat Mar 9 18:00:58 CST 2013


On Sat, 9 Mar 2013, Carlos AB wrote:

>
> [01-Mar-2013 07:09:12 UTC] PHP Warning:  Cannot modify header information -

This is almost(?) always stray characters before or after your php brackets,
usually hard to spot white space like a space, tab, or newline.

* Be sure <?php is in the first column of the first line. (No space or
newline before it.  Some editors indent code for various usually convenient 
reasons, so if you have clipped some php from another place, be sure there
aren't tabs or spaces coming along for the ride on the first line.

*If you are in php at the end of a page, you do not have to use the closing
tag ?> and there is a good reason not to.  If you put the closing tag in,
any character after it, even just a newline, can be harmful.  Some editors
automatically add a newline at the end of a file when you save if there is
not one at the end - which can be good in some circumstances, but is
inviting disaster if you use php closing tags.  When you include the file,
you have introduced some white space and since it is outside the php tags,
it leaks through to your document.  If it comes first, it is mistaken for a
http header.  Get out of the habit, if you are in it, of closing php at the
bottom of a page.  Notice that pmwiki.php and the scripts do not have
closing tags.




-- 
Lars Eighner
http://www.larseighner.com/index.html
8800 N IH35 APT 1191 AUSTIN TX 78753-5266




More information about the pmwiki-users mailing list