---
title: "PHP服务器 Cookie设置问题-Cannot modify header information - headers already sent by"
author: "ranyut"
date: "2016-06-25T21:13:58Z"
tags: []
categories: ["编程语言"]
slug: "php-cookie-cannot-modify-header-information-headers-already-sent-by"
draft: false
lastmod: "2016-06-25T21:17:10Z"
id: 2307297
url: "https://just4java.iteye.com/blog/2307297"
---

部署PHP代码到阿里虚拟云主机，出现错误，而在本地一切正常，服务器上却是一版空白。

这个问题困扰了三天，终于解决。

 

在页面跳转时发现以下错误信息：

 

Warning:  Cannot modify header information - headers already sent by (output started at 

 

/data/home/qxu2309260022/htdocs/config/config.php:1) in 

 

/data/home/qxu2309260022/htdocs/celive/include/celive.class.php on line 66

 

Warning:  Cannot modify header information - headers already sent by (output started at 

 

/data/home/qxu2309260022/htdocs/config/config.php:1) in 

 

/data/home/qxu2309260022/htdocs/celive/include/celive.class.phpon line 68

 

\---------------------------------------------------------------------------------------------

是因为程序需要输出缓冲区数据块output\_buffering参数开启，虚拟主机默认该参数设置为关闭状态导致。

 

 

解决方法：登录[http://cp.hichina.com](http://cp.hichina.com/)控制面板，点击左侧网站高级环境设置--php.ini设置，将【输出缓冲区数据块设置】设置为【启用】，重启服务后生效，设置生效后再测试访问即可恢复正常。

 

 ![](http://dl.iteye.com/upload/picture/pic/135797/59226802-3e6b-3b2e-98c2-d0d14f319358.jpg)