I have a very strange problem. I have a PHP script running on my own computer (WinXP w/ Apache 1.3.22). It works fine when accessed from my computer, using any of the possible addresses: 127.0.0.1, my address on our LAN, or my address on the Internet. But when another computer tries to access the script, either through the LAN or through the Internet, a very strange problem rears its ugly head.
I did say any computer, and that includes the W3C Validator. When I try to validate the page, it says it encountered an unexpected error: "500 bad header:" and then it displays a line of the HTML source that the PHP script outputs! The line of HTML that is displayed is NOWHERE near the top of the source. How it could be mistaken for a header is a complete mystery to me.
When viewed through Internet Explorer from another computer, the page reads part of the HTML, then refreshes, then reads part of it again, then refreshes again. Endlessly refreshing.
I Telnet'ed to my computer and requested the URI of the script. The amount of HTML returned before the connection is closed is inconsistent, but there are never any headers. The first line of the response is always "".
It gets weirder, however. If I put in a die(); in the middle of the PHP code, it works. If I take out a section of the HTML, it works. There are any number of tiny things I can remove so it'll work, but as it is, it endlessly refreshes and gives bad header errors.
Also, for the heck of it I uploaded the script to the remote server that I use for my actual website (run by someone who actually knows what he's doing, with Linux/Apache 1.3.24, but I don't see why that should make a difference), and it works fine. From any computer. Aaaack!
ANY and ALL thoughts (no matter how far-fetched) as to why this might be happening will be rewarded with eternal friendship. 😃
Thanks in advance,
Linus