title: Does a PHP session work across subdirectories?
body: <p>I have a main directory named <code>System</code> with a sub-directory named <code>Subsystem</code>. My session from main directory is not working in the sub-directory.</p>
  
  <p>When I <code>echo session_save_path();</code> in both folders, they show me <code>"/tmp"</code>.</p>
  
  <p>Then, I tried to put <code>session_save_path("../tmp");</code> in my sub-directory but it shows me <code>"This webpage has a redirect loop"</code>.</p>
  
  <p><code>session.php</code> in <code>System</code> directory:</p>
  
  <pre><code>&lt;?php
  session_start( );
  
  if (!($_SESSION['uid']))
  {
      header("Location:index.php");
  }
  else
  {
      $_SESSION['uid'] = $_SESSION['uid'];
  }
  ?&gt;
  </code></pre>
  
  <p>session.php in Sub-system folder:</p>
  
  <pre><code>&lt;?php
  session_save_path("../tmp");
  session_start( );
  
  if (!($_SESSION['uid']))
  {
      header("Location:index.php");
  }
  else
  {
      $_SESSION['uid'] = $_SESSION['uid'];
  }
  </code></pre>
  
  <p>?></p>
  
  <p>I have Googled all over, but I still cannot get it to work.</p>