title: IE / Edge session cookie problems using cookie_lifetime
body: <p>Since a couple of days (at least, that I'm aware of), I cannot login to my website using Internet Explorer or Edge. The login does work using Firefox and Chrome! I have witnessed the problem on other computers as well, indicating that it is not a local browser problem.</p>
  
  <p>I am aware that IE / Edge silently drop cookies from domains with a _ in the subdomain, however in my situation there is none.</p>
  
  <p>After allot of sweat and pain, I have reduced the script to the bare minimum to replicate the problem.</p>
  
  <p>I have also found the the problem, but I have no true solution.</p>
  
  <pre><code>&lt;?PHP
      ini_set( 'session.cookie_lifetime', '3600' );
  
      if( session_id() == '' )
          session_start( );
  
      $i = 1;
      if( isset( $_POST['logout'] ) ) {
          unset( $_SESSION['loggedin' . $i] );
          session_destroy();
          header( 'Location: http://jbtje.com/test' . $i . '.php' );
      }
      if( isset( $_POST['login'] ) ) {
          $_SESSION['loggedin' . $i] = 'LOGGED IN: ' . $i;
          header( 'Location: http://jbtje.com/test' . $i . '.php' );
      }
  ?&gt;&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;TEST &lt;?PHP $i ?&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;?PHP echo 'You are currently ' . (isset($_SESSION['loggedin' . $i]) ? $_SESSION['loggedin' . $i] : 'not logged in ' . $i); ?&gt;
  &lt;form method="POST"&gt;&lt;input type="submit" name="login" value="login" /&gt;&lt;/form&gt;
  &lt;form method="POST"&gt;&lt;input type="submit" name="logout" value="logout" /&gt;&lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Test site: <a href="http://jbtje.com/test1.php" rel="nofollow noreferrer">http://jbtje.com/test1.php</a></p>
  
  <p>If you press the login button, the text should change to "You are currently LOGGED IN". But, it does not.</p>
  
  <p>IF however you comment the ini_set line out, (and change $i to 2):
  <a href="http://jbtje.com/test2.php" rel="nofollow noreferrer">http://jbtje.com/test2.php</a> it <strong>does</strong> work....</p>
  
  <p>Why does setting cookie_lifetime using PHP cause IE and Edge to not store the cookie? (and how to solve this...?)</p>
  
  <p>Best regards,
  Jeffrey</p>