title: $_SESSION is empty after reloading page
body: <p>My script, <code>test.php</code>, is below.  When I click on Submit, it processes this as a login attempt and successfully sets up <code>$_SESSION</code> variables.  But when I reload the page (by clicking a link back to itself), <code>$_SESSION</code> is empty.  </p>
  
  <pre><code>&lt;?php
      //test.php
  
      session_start ();
  
      function isUserLoggedIn (&amp;$username)    
      {
          $loggedIn = isset ($_SESSION['loggedin']);
          if ($loggedIn) 
              $username = $_SESSION['user']; 
          else 
              $username = ''; 
  
          return $loggedIn;
      }
  
      function processLogin () 
      {               
          $_SESSION['loggedin'] = TRUE;
          $_SESSION['user']  = "podunk";
  
          session_write_close ();         
      } 
  
      echo '$_SESSION before we do anything..................: '; 
      print_r ($_SESSION); 
      echo "&lt;br&gt;";
  
      if (isset($_POST['Submit'])) processLogin ();
  
      $loggedIn = isUserLoggedIn ($username); 
  
      echo '$_SESSION after processing any login attempt: '; 
      print_r ($_SESSION); 
      echo "&lt;br&gt;";
  
      if ($loggedIn) 
          echo "I AM LOGGED IN as $username!"; 
      else 
          echo "I am logged out :(";
  ?&gt;
  
  &lt;html&gt;
    &lt;body&gt;    
      &lt;form name="form1" method="post" action="test.php"&gt; 
          &lt;input type="submit" name="Submit" value="Login"&gt;
      &lt;/form&gt;
  
      &lt;a href="test.php"&gt;Reload page&lt;/a&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is when I run it on my Linux apache2 server.  When I run it on XAMPP, $_SESSION persists and the user remains logged in.  So I am guessing it's something to do with php.ini... but maybe I've got a mistake here and XAMPP is being forgiving.  </p>
  
  <p>The Linux server is successfully running WordPress, so its setup can't be too strange.  Just did a system upgrade, as <a href="https://stackoverflow.com/questions/35841087/session-is-empty-after-redirecting">recommended</a>.  The session.save_path exists and has something in it dated today, so I assume it's working, although it's owned by root not www-data, so IDK if that's an issue.</p>
  
  <p>Here are some other things from php info.  IDK about that cookie_path, so I changed it to the same place as session.save_path, FWIW.</p>
  
  <pre><code>session.auto_start  On  On
  session.cache_expire    180 180
  session.cache_limiter   nocache nocache
  session.cookie_domain   no value    no value
  session.cookie_httponly Off Off
  session.cookie_lifetime 0   0
  session.cookie_path /   /
  session.cookie_secure   Off Off 
  </code></pre>
  
  <p>Behavior is the same using Chrome, Firefox, and IE.</p>
  
  <p>TIA.</p>