0

Now a days, I have developed a CodeIgniter Application for a Medical service website. There has a chat option. for this chat feature, I have create Session. Config file code

$config['encryption_key'] = 'CoderSaiful';
$config['sess_cookie_name']     = 'ci_session';
$config['sess_expiration']      = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie']  = FALSE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']      = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = 300;

Autoload file Code:

$autoload['libraries'] = array('database','form_validation','session');

Controller chat.php file code:

function index(){
$user_data = $this->session->all_userdata();
$data['title'] = 'Live Chat';
$data['sub_title'] = 'Chat with each other and free';;
$this->load->model('options_m');
$data['menu']=  $this->options_m->menu(); 
$data['site_info']=  $this->options_m->site_info();
$this->load->view('template/header_with_menu_with_top',$data);

            if(isset($user_data[0])){
//enter code here
            }
            else{
                $this->load->view('chat/form');  
            }
        /*
        $this->load->view('chat/form');

        $this->load->model('chat_m');
        $data['chat'] = $this->chat_m->get_chat();
        */

        $this->load->model('chat_m');
        $data['chat'] = $this->chat_m->get_chat();
        $this->load->view('chat/live',$data);

        if(isset($user_data[0])){
              $this->load->view('chat/chat_form',$user_data);   
            }

        $this->load->view('includes/footer');
        //dump($data);
    }

I think, all are right and it work properly, when I check on my local pc wamp server. But When I have uploaded to my web server. It show error. Like this:

Severity: Warning <br>

Message: Cannot modify header information - headers already sent by (output started at /home/saifulbd/public_html/jessorepublichealth.com/application/controllers/chat.php:1)<br>

Filename: libraries/Session.php<br>

Line Number: 675<br>

Now I would like to get great solution for this error.

Albzi
  • 15,431
  • 6
  • 46
  • 63
Saiful Islam
  • 332
  • 6
  • 15
  • check this link i hope this will help you http://stackoverflow.com/questions/15974891/codeigniter-message-cannot-modify-header-information-headers-already-sent-by – Dexter Mar 20 '14 at 11:14
  • Note that headers should be sent before anything else. Make sure that there is no code/html or even space/indentation before the header function and there is nothing before the first opening php tag in your view. – Dexter Mar 20 '14 at 11:16

1 Answers1

0

It it works fine with your local dev platform

2 things ive seen you much check for this one is

File System paths configuration

.htaccess if you got one

as seen in your statement your ftp dir was

/home/saifulbd/public_html/ci_folder/

as of wampp that is only

/www/ci_folder
Jhonathan H.
  • 2,734
  • 1
  • 19
  • 28