I recently got a stray character between function definitions in an include file and didn’t notice it for a while.
On my development server, this wasn’t an obvious problem. The character printed and got immediately overwritten by a banner. I never even saw it. Whenever I came to a header(‘Location: xxx’), it executed normally.
But on the production server, I immediately started getting a “headers already sent” error whenever that redirect was encountered, which is what eventually alerted me to the stray character in the first place. (Though it took some time to uncover it.)
My question is why did it ever work on the development server? What .INI or other settings can cause this difference in behavior? Is there one for some kind of default output buffering or is this an error-reporting inconsistency? I’m sure there are small configuration differences between the two environments, but I haven’t customized anything remotely related to these behaviors.
Development is running php 5.3.3 under Apache 2.2.16 on Linux.
Production is running php 5.3.6 under Apache 2.2.20 on FreeBSD.
sounds like you had output buffering enabled on your development server. (php.ini:
output_buffering) should be “off” or a number of bytes to buffer.