ZF报错处理

本文讨论了在PHP控制器层中遇到无法发送头部错误的常见问题,并提供了详细的解决方案,包括程序方面、php.ini配置调整及文件路径问题。通过移除特定字符、修改配置项及确保文件路径正确,可以有效解决此问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Fatal error: Uncaught exception 'Zend_Controller_Response_Exception' with message 'Cannot send headers; headers already sent in
 D:\xampp\htdocs\study\quickstart\application\controllers\IndexController.php, line 35' in
 D:\xampp\php\PEAR\Zend\Controller\Response\Abstract.php:282 Stack trace: #0
 D:\xampp\php\PEAR\Zend\Controller\Response\Abstract.php(300):

1.程序方面的原因:
  • Any HTML output, including the DOCTYPE declaration or any HTML tag, including the head of the page
  • Extra whitespace before the opening PHP tag of the page, or outside the PHP tags of an include file
  • Using print() or echo before calling header() or session_start()
  • Using virtual() to include files
  • Using the byte-order mark (BOM) at the beginning of a page
  • 把controller层里面的最后的 “?>”去掉就ok了

php.ini方面的原因:

2.修改php.ini的参数配置项

  output_buffering off 修改为output_buffering on

session.use_cookies = 1


3.还有在搭建PHP环境的时候php.ini文件的加载路径是在/etc/php.ini, 而php.ini实际路径在/use/local/php/php.ini文件下,

导致Apache加载不到配置文件,所以重启了Apache服务器也没有反应




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值