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

被折叠的 条评论
为什么被折叠?



