0

I am trying to output the cookies I get from the user, when I open the network section in the Developer Tools,if I open the request I find the cookie in the Request Headers, but when I am output the cookie

$this->input->cookie();

I am getting;

array(0) { }

Session Config

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = FCPATH . 'application/ci_sessions/';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

Cookies Config

$config['cookie_prefix']    = '';
$config['cookie_domain']    = '';
$config['cookie_path']      = '/';
$config['cookie_secure']    = FALSE;
$config['cookie_httponly']  = FALSE;

I am using Codeigniter 3.0.0, OS Fedora 27, Server Apache I tried this on different browsers, Chrome and Firefox

Request Headers and Response Headers

Thanks in advance.

  • I think if you want to output the cookie, you need to do so by name. So, based on your image, `$this->input->cookie('ci_session')` or `$this->input->cookie('ci_session', TRUE)`. [Check this article for more info](https://stackoverflow.com/questions/6409994/how-to-retrieve-cookie-value-in-codeigniter). – cfnerd Mar 12 '18 at 13:32
  • Also...are you loading the cookie helper in the controller or via autoload? – cfnerd Mar 12 '18 at 13:36
  • If you want to get the ci_session value, just use `session_id()` – jtheman Mar 12 '18 at 13:40
  • It's great to see how you're checking for cookie contents, but without seeing how you are setting the cookie, then how would we know what's going on? Please add your cookie related config and code showing how you are setting the cookie. – Brian Gottier Mar 12 '18 at 15:18
  • 1
    @BrianGottier I added the configuration, and to be specific what I am having problem with is the session's cookie, which is being regenerated each time I make a request. @cfnerd I am loading using the autoload, and I if I did var_dump() or print_r() for `$this->input->cookie()` I will see all the cookies including the **ci_session** – Saed Ramadan Mar 13 '18 at 13:22

1 Answers1

0

What solved my problem was replacing my Session folder with a new one from a newer version of Codeigniter.

System -> libraries -> Sesssion