I’ve just wasted the good part of half a day trying to find what was causing 2 mysterious carriage returns at the top of my website.
The cause it turns out was that the PDF class I use had a few blank carriage returns after the ?> terminator at the end of the php file. These blank lines were being interpreted as output and included in the output of my web application, hence causing the mysterious carriage returns.
What many people do not realise, is you do not need the terminating ?> at the end of your code. By leaving it out, issues just like the one I experienced are prevented.
Unfortunately, no fancy debugging tools that I am aware of can revealed this. I ended up having to echo “start” and “end” in my code, progressively narrowing the position until the line that was at fault was revealed. That took ages, and would have been worse if I didn’t have the foggiest idea what file could have been the cause.
It would be nice if there were a tool that could tell you what file was responsible for sending output to the browser.


