开发者

New line before header()

I'm working with a custom made Joomla script that generates an image from a blob in a database. However, when we moved it from an Apache server to an IIS server, the script is breaking.

Upon investigation, it seems that now, there is a line break that is getting appended before the header function is being run (when I comment out the image portion, and do an echo "test";, test g开发者_如何学Goets printed on line 2 of the source code.

I've gone through the script over and over again, and through the many files in the component, and can't seem to find out where this new line is coming from. At all.

I've tried using ob_start() and many similar functions, but nothing seems to work.

I'm completely out of ideas, and don't know where to turn.

Is there a way to trace what files are being called in the page, perhaps? Any thoughts on further steps?


Look out for additional whitespace at the end of PHP files. If a PHP file ends in more than a single return after the last ?>, that stuff gets printed regardless of where the file is/was included. That is a common error source in larger PHP projects and would meet your symptoms.

(To circumvent this, some have started with a coding standard that prohibits the last ?> in their source files, which is perfectly legal PHP.)


Be careful, maybe it's an encoding problem. Open the file with vim under linux to see if there an ^M or something like that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜