In your save path, you need to set up a location folder. Use 'files' as your preferred session driver. As shown below, I configured the cache for storing sessions in the BASE PATH, which sets the folder. Make sure you download the automatically loaded sessions and $config['encryption_key'] = '' add the key.
You can set up database sessions, but it works just as well. Verify that the permissions on the 0700 folder
http://www.codeigniter.com/userguide3/search.html?q=session&check_keywords=yes&area=default
$config['sess_driver'] = 'files'; $config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 1440; $config['sess_save_path'] = BASEPATH . 'yourfoldername/cache/'; $config['sess_match_ip'] = TRUE; $config['sess_time_to_update'] = 300;
Once this is done, you will be able to do something like.
$this->load->library('session'); $data_session_set = array('logged' => 1, 'username' => $this->input->post('username'), 'user_id' => $this->user_auth->get_id()); $this->session->set_userdata($data_session_set);
source share