Codeigniter - Cannot modify header information - h

2020-04-07 04:32发布

A PHP Error was encountered
Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/aphotel/public_html/application/config/config.php:1)

Filename: libraries/Session.php

Line Number: 366
#

Weird part of it, there is no session.php file in libraries folder

标签: codeigniter
8条回答
贼婆χ
2楼-- · 2020-04-07 05:05

I had this problem before and it was caused by output_buffering was Off.

Edit your php.ini and search for output_buffering and make it looks like this

output_buffering = On
查看更多
看我几分像从前
3楼-- · 2020-04-07 05:08

Make sure you do not have any white space characters before the opening php tag in your controller class.

查看更多
Luminary・发光体
4楼-- · 2020-04-07 05:08

There seems to be whitespace before the php open tag

查看更多
贼婆χ
5楼-- · 2020-04-07 05:12

In PHP Use " ob_start(); " at first line and in CI controller constructor at first line " ob_start(); " //output buffer

查看更多
趁早两清
6楼-- · 2020-04-07 05:12

There is space before the <?php tag in the below file. I have seen this issue multiple times.

(output started at /home/aphotel/public_html/application/config/config.php:1)
查看更多
Emotional °昔
7楼-- · 2020-04-07 05:14

Just load session library first.

$autoload['libraries'] = array('session', 'encrypt', 'database',...
查看更多
登录 后发表回答