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.
 
     
    