Friday, February 10, 2012

Cannot modify header information的问题

2009-04-05 by zhiwei  

今天安装wordpress遇到了一个问题,相信 很多朋友在安装wordpress应用程序或其他PHP应用程序时也遇到过这样的问题:Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/public_html/wp-config.php:1) in /home/xxx/public_html/wp-includes/pluggable.php on line 7 ,我安装过两次,都遇到了这样的问题。

第一次是安装好之后要修改conifg.php里面的数据连接问题,结果出现了这个提示。还有一次是在安装时出现了这个提示,我在网上找了很长时间,最终发现在一篇文章里看到了解决办法。

其实大部分网友使用的编辑器,可能都是 Windows 操作系统所自带的记事本程序(Notepad.exe),而这个程序所支持的编码格式只有 ANSI, Unicode big endian, Unicode 和UTF8 四种。因此,当修改为 wp-config-sample.php 文件(这里以wordpress配置文件为例),另存为 wp-config.php 文件的时候,原本的 UTF8 no BOM(Byte Order Mark) 格式,就是自动保存为 UTF8 ( with BOM )格式。记事本给文件自动添加 BOM (字节顺序标志),因此 wp-config.php 第一行就多出了一个 php 无法识别的标志,因此也就带来了上述的困扰。

解决办法就是在自己电脑上打开该文件,然后另存为ANSI编码格式。当然,你电脑上如果有能区别UTF8 no BOM与UTF8 with BOM 编辑器的话,你也可以把文件存为UTF8 no BOM格式,这样就不会再出现那个warning了,一切都搞定了。

© 2009, chenzhiwei.net. 版权所有.
本文永久链接:http://chenzhiwei.net/2009/04/cannot-modify-header-information/

Comments

One Response to “Cannot modify header information的问题”

Trackbacks

Check out what others are saying about this post...
  1. [...] 转载自:http://chenzhiwei.net/2009/04/cannot-modify-header-information/ // 返回顶部的jquery jQuery(document).ready(function($) { $body = (window.opera) ? (document.compatMode == "CSS1Compat" ? $('html') : $('body')) : $('html,body');// 这行是 Opera 的补丁, 少了它 Opera 是直接用跳的而且画面闪烁 by willin $('#content .gotop').click(function(){ $body.animate({scrollTop: $('#header').offset().top}, 1000); return false;// 返回false可以避免在原链接后加上 }); }); 返回顶部 分类: 杨老虎之家  > 电脑 > 环境相关 > 安装 worldpress 时候 Cannot modify header information的问题 上一篇:(已经是最新的) 下一篇:玩万智牌的好东东 “Magic Workstation” // li {list-style-type:none;} [...]



Speak Your Mind