HeadersAlreadySentException: Headers already sent in

安装报错 · resetl · 于 5年前 发布 · 2710 次阅读

老师,又来麻烦您了。

An Error occurred while handling another error:
yii\web\HeadersAlreadySentException: Headers already sent in /www/web/fecshop/appfront/web/index.php on line 1. in /www/web/fecshop/vendor/yiisoft/yii2/web/Response.php:366
Stack trace:
Previous exception:
yii\base\ErrorException: session_start(): Cannot send session cookie - headers already sent by (output started at /www/web/fecshop/appfront/web/index.php:1) in /www/web/fecshop/vendor/yiisoft/yii2/web/Session.php:137
Stack trace:
共收到 5 条回复 问题提问
resetl#15年前 0 个赞

CSDN有一个解决的办法https://blog.csdn.net/renamayu/article/details/79799208

使用echo 输出json格式输出,结尾没有加exit导致的报错

但我还是不明白

Terry#25年前 0 个赞

你是不是动了文件 /www/web/fecshop/appfront/web/index.php

是不是在 <?php 前面有空格, 或者在里面有输出?

resetl#35年前 0 个赞

没有动过,安装之后显示

An internal server error occurred.

为了看错误信息,我才修改了下面的地方

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
Fecmall#45年前 0 个赞

你是在所有的页面都会包这个错误,还是某些页面报这个错?

Headers already sent,这个报错的意思是:

在headers信息输出的前面不能有任何的输出信息,如果有,就会报错。

自己排查吧,玩fecshop,就得自己有排查问题的能力

resetl#55年前 0 个赞

所有页面都有,OK,我再试试

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics