Sree ram
Sree ram

Reputation: 379

Codeigniter: Message: Cannot modify header error

This type of question is already asked before

Codeigniter: headers already sent error

CodeIgniter headers already sent error with different Server

Codeigniter - Cannot modify header information - headers already sent by

Codeigniter: Message: Cannot modify header information - headers already sent by (output started at

http://ellislab.com/forums/viewthread/69280/#468283

Codeigniter: Message: Cannot modify header information - headers already sent by (output started at

Exact Error I am Getting

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home2/hanomart/public_html/ClickMyStay/application/controllers/welcome.php:472)

Filename: libraries/Session.php

Line Number: 675

What i am doing at welcome.php:472 Line

I am changing a session value like as below

$value="Some Value";
$session_data=array("hotel_search_value" => $value);
$this->session->set_userdata($session_data);

I have tried in below ways.

  1. Checked White spaces before <?php and after ?> (Everything is fine.No white spaces).
  2. Changed $_SERVER['REMOTE_ADDR'] to $this->server('remote_addr') in line system/core/Input.php Line no 351

But those things didnt solve my problem.

Can anyone help me out in this issue.

Thanks in advance,

Sree ram

Upvotes: 0

Views: 3876

Answers (1)

Kyslik
Kyslik

Reputation: 8385

Turn off all echo()ing and var_dump()ing before line 472.

Headers are sent whenever is something echo()ed out so session library can not modify sessions in that point and it triggers error.

Upvotes: 3

Related Questions