5
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

Panos Mavromytis
  • 51
  • 1
  • 1
  • 2
  • 1
    As mentioned, I should have read some of the other posts here, I just found the solution this by the follwing: place this ob_start(); on first line of index.php under your application directory like this : ' – Panos Mavromytis Feb 08 '13 at 09:30
  • possible duplicate of [Headers already sent by PHP](http://stackoverflow.com/questions/8028957/headers-already-sent-by-php) – Jocelyn Mar 25 '13 at 02:00
  • http://stackoverflow.com/questions/15974891/codeigniter-message-cannot-modify-header-information-headers-already-sent-by check this – Dexter May 02 '14 at 11:41

8 Answers8

8

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
Ashraf Kaabi
  • 121
  • 1
  • 5
8

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

Anil Gupta
  • 1,593
  • 1
  • 19
  • 21
4

Remove print_r(); in controller, model or session. There are problem or warning when website upload in host server not warning in localhost

4

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

mohsin139
  • 967
  • 7
  • 6
4

There seems to be whitespace before the php open tag

Neil Dhakal
  • 363
  • 4
  • 11
4

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)
Donovan
  • 906
  • 2
  • 11
  • 17
3

I changed encoding to 'UTF-8 without BOM' for all php files in model, controller and helper folders and that helped.

user1080381
  • 1,597
  • 1
  • 16
  • 22
2

Just load session library first.

$autoload['libraries'] = array('session', 'encrypt', 'database',...
fcfeitosa
  • 63
  • 6