title: Php sessions appear to get dropped/lost on regeneration
body: <p>I'm using 24 hour sessions at the moment to keep users logged in, if they browse to another page of the site after 30 minutes of the session starting then the session will be regenerated to extend the session expiration time to time() + 24 hours.</p>
  
  <p>I am using php.ini to ensure only cookie sessions are used and altered their default save time to just over 24 hours:</p>
  
  <pre><code>session.gc_maxlifetime = 90000
  session.cookie_lifetime = 90000
  session.use_trans_sid = 0
  session.use_only_cookies = 1
  </code></pre>
  
  <p>I use the following to being a session:</p>
  
  <pre><code>session_save_path("/home/user/sessions");
  session_set_cookie_params("86400", "/");
  session_name("auth");
  session_start();
  </code></pre>
  
  <p>but at the moment my sessions seem to get lost within the first hour. The cookie <code>auth</code> is still there but it doesn't seem to link to the information that was stored when the session was made:</p>
  
  <pre><code>$_SESSION['userId'] = $row[0];
  $_SESSION['created'] = time();
  </code></pre>
  
  <p>This leads me to think that the regeneration part is somehow incorrect?</p>
  
  <p>To regenerate a cookie after 30 minutes I am using:</p>
  
  <pre><code>if($_SESSION['created'] + 30 * 60 &lt; time())
  {
      session_regenerate_id();
      $_SESSION['created'] = time();
  }
  </code></pre>
  
  <p>Does the above code need to have some way to keep the session id after regeneration?</p>
  
  <p>Like:</p>
  
  <pre><code>$sid = session_id();
  session_regenerate_id();
  session_id($sid);
  session_start();
  </code></pre>
  
  <p>or is this not necessary? Are there any other reasons my sessions could be getting lost/mixed up?</p>