title: PHP session variables not being set
body: <p>I'm having trouble with PHP session variables: I try setting the variables, and they can't be read even in the same file, much less another file.</p>
  
  <p>Sorry if the question has been asked before, but I can't find anything that doesn't say "make sure you have <code>session_start()</code> at the beginning of the file."</p>
  
  <p>Lines 1, 2, &amp; 3 of file:</p>
  
  <pre><code>&lt;?php
      ini_set('session.save_path','/home/[username]/session_data'); // Just in case, points to a correct directory
      session_start();
  </code></pre>
  
  <p>Later, after username validation, and login, the variables are set, and code tries to <code>echo</code> them out:</p>
  
  <pre><code>$_SESSION['login'] == "true";
  $_SESSION['username'] == $username;
  $_SESSION['password'] == sha1($password);
  //header("Location: [admin page hidden]"); // Code would normally redirect to admin page (commented out for debugging), and exit
  //exit;
  echo "Username: ".$username."&lt;br /&gt;"; // The following 4 lines try to print out the data
  echo "Password: ".$password."&lt;br /&gt;";
  echo "Secure Password: ".sha1($password)."&lt;br /&gt;";
  echo "Session Username: ".$_SESSION['username']."&lt;br /&gt;";
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>Username: root
  Password: [correct password]
  Secure Password: [correct sha1 version of password]
  Session Username: 
  </code></pre>
  
  <p>The secure password (<code>sha1</code>, what is checked) matches what is in the database file, I checked.  Nothing comes out for the session variables, even though it was created 7 lines previously.  The directory that I pointed the save path to just has a blank file for the session.</p>
  
  <p>Does anyone have any clue why this doesn't work, or advice on how to proceed?  Any helpful response is appreciated.</p>