0

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

3
  • 2
    are you echoing or vardumping anything before line 472? (even $this->load->view('') counts) Commented Jan 22, 2014 at 12:51
  • Oh...!!!! Yes. I kept that for testing. Will it create problem.? Commented Jan 22, 2014 at 12:56
  • 2
    Turn it off and there shouldnt be that error. Commented Jan 22, 2014 at 12:58

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.