title: codeigniter remember me for login by session
body: <p>My config.php setting</p>
  
  <pre><code>$config['sess_driver'] = 'files';
  $config['sess_cookie_name'] = 'ci_session';
  $config['sess_expiration'] = 0;
  $config['sess_expire_on_close'] = TRUE;
  $config['sess_save_path'] = NULL;
  $config['sess_match_ip'] = FALSE;
  $config['sess_time_to_update'] = 300;
  $config['sess_regenerate_destroy'] = FALSE;
  </code></pre>
  
  <p>As per docs its working fine, session expiring on browser close.
  But what if i want to hold session for 1 year (Remember me feature).</p>
  
  <p>I tried to overwrite settings for remember me. But failed</p>
  
  <pre><code> $new_expiration = (60*60*24*365); //A year milliseconds
  
   $this-&gt;config-&gt;set_item('sess_expiration', $new_expiration);
   $this-&gt;config-&gt;set_item('sess_expire_on_close', FALSE);
  
   $this-&gt;session-&gt;sess_expiration = $new_expiration;
   $this-&gt;session-&gt;sess_expire_on_close = FALSE;
   $this-&gt;session-&gt;set_userdata('name','virat');
  </code></pre>
  
  <p>Checking code on another file</p>
  
  <pre><code> echo $this-&gt;session-&gt;userdata('name');
  print_r($this-&gt;session-&gt;userdata());
  </code></pre>
  
  <p>Is there any way to hold session by ignoring default settings?
  What i am doing wrong?
  Version: CI3</p>
  
  <p>Update ->>
  I am still trying to make it happen. I think i found a workaround.
  CI updates the session cookie file every time you read the session.</p>
  
  <p>and another problem is CI not update the config.php values simply via $this.</p>
  
  <p>So</p>
  
  <pre><code>public function __construct()
      {
          parent::__construct();
          $this-&gt;CI = &amp; get_instance();
          $this-&gt;CI-&gt;config-&gt;set_item('sess_expiration', 1253);
  
  
      } 
  </code></pre>
  
  <p>Make direct call to CI itself works. it updates the config.php variable.
  another point is you need to do this in every Controller a "single read without config.php overwrite" will erase the cookie values and session values. You can also include it in MY_controller optional. </p>