简体   繁体   English

使用 fastcgi 运行 utf8 编码的 php 脚本

[英]running utf8 encoded php script with fastcgi

I have installed Nginx and I used fastcgi to run php script.我已经安装了 Nginx 并使用 fastcgi 运行 php 脚本。

When I run php script encoded as "utf8" I have got an error about "header":当我运行编码为“utf8”的 php 脚本时,出现关于“header”的错误:

FastCGI sent in stderr: "PHP Warning: Cannot modify header information - headers already sent by (output started at /xxx/myScript.php:1) in /xxx/myScript.php on line 29.... 在 stderr 中发送的 FastCGI:“PHP 警告:无法修改 header 信息 - 标头已由 /xxx/myScript.ZE1BFD762321E409CEEZAC0B26 上的 /xxx/myScript.php:1 开始(输出开始于 /xxx/myScript.php:1)发送

If I encode the same script in "ascii", I have not this error.如果我在“ascii”中编码相同的脚本,我就没有这个错误。

I have a lot of scripts and some of them are in utf8.我有很多脚本,其中一些是 utf8 格式的。

Does anybody know how to run utf8 script with fastcgi?有人知道如何用 fastcgi 运行 utf8 脚本吗?

Configure your editor to store UTF-8 files without BOM.配置您的编辑器以存储没有 BOM 的 UTF-8 文件。 Open your file in an hexeditor to see the BOM to confirm, as in normal editors you won't see it.在 hexeditor 中打开您的文件以查看 BOM 以进行确认,因为在普通编辑器中您不会看到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM