Forum Moderators: coopster

Message Too Old, No Replies

how to avoid unnecessary 'CANNOT MODIFY HEADER' ?

         

dulldull

12:51 pm on Jul 29, 2009 (gmt 0)

10+ Year Member



It seems that "CANNOT MODIFY HEADER --- Headers already sent by .... " is a very common error message in php.

It happens to me sometimes when I copy the code from developers' site and paste it in ultraedit.

When i think the plugin or extensions must be wrong, i can actually run the code file directly downloaded from developers' site.

The error seems to be caused during the copy and paste process. Perhaps there's a line break? I'm not sure about it.

Do you know how i can avoid these unnecessary errors when i need to copy a code from a website?

Thanks a lot!

janharders

1:02 pm on Jul 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



have you tried putting @ in front of the function-call?

But: those messages are not uncessary - the headers the script tried to set were not set and thus things won't work the way they are supposed to, just not showing the warning will still leave you with code that does not work like it is supposed to.

jatar_k

1:02 pm on Jul 29, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you get headers already sent when anything is sent to the browser

a line break or a space before your opening php tag is probably the most common, the others are just early echos

dulldull

3:32 pm on Jul 29, 2009 (gmt 0)

10+ Year Member



thanks for all replies. I think the problem with me isn't about wrong code and possibly not related to a space before opening php tag too.

after many attempts at solving the header problem with the mediawiki extension i'm using, i finally solved it by opening a workable extension (a php file), and paste the code into it. Interestingly, it's solved.