开发者

headers already sent displays after moving files from one server to another [duplicate]

This question already has answers here: How to fix "Headers already sent" error in PHP (11 answers) Closed 9 years ago.

I have a project running on dreamhost hosting and it's working fine, but since DH has been getting really slow I'm moving the project to my new dedicated server.

The thing is that after I move all of my file over to the new dedicated (ubuntu 8.4) I get see warnings all over the place telling me that the headers had been already sent.

The first thing I tried was moving the files via 开发者_运维百科FTP: download to my machine, upload to server - Didn't worked

Second try was tar.gz the folder on the first server and untar it on the new one, didn't worked either

I tried chaing enconding to ANSI and they start working, however most of my files contain accents so ANSI is not an option for all my files i need UTF8

Any ideas on how to fix this? I'm sure it must be some sort of config


  1. If changing from utf-8 to 'ansi' makes it work, you have an UTF8-BOM in your files: remove them, either by using a hex editor (lots of work), or by using an editor which understands (or can be configured) not to put the utf8-BOM there. You normally wouldn't see these characters in an editor, so effectively it seems there's no output before the <?php. See: http://en.wikipedia.org/wiki/Byte_order_mark
  2. As a temporary fix you can set the output_buffering setting to On in .htaccess / php.ini to always buffer untill you've fixed all the files.


Check for a space for new line character after closing ?> on any of the files.

Also, the warning that you speak of actually tells you the file and line that the output started at so it gives you a place to start looking...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜