title: php session_start with include files
body: <p>i learned a lot about session start from my <a href="https://stackoverflow.com/questions/6913426/jquery-progressbar-loads-all-at-once/6913531#6913531">previous question</a>. Now i'm wondering how session locking occurs when files are included in other files. Lets say i have:</p>
  
  <p>page.php</p>
  
  <pre><code>include('header.php');
  ...some html content....
  include('sub_page.php');
  ...more html....
  </code></pre>
  
  <p>header.php:</p>
  
  <pre><code>session_start();
  ..save session vars...
  ..print web page header...
  </code></pre>
  
  <p>sub_page.php</p>
  
  <pre><code>session_start();
  ...use session vars....
  ..print page content...
  </code></pre>
  
  <p>When i open page.php, does the session become unlocked as soon as header.php is done? or is it live for the whole page.php life, so sub_page's session is blocked? Is the <code>session_start</code> in sub_page necessary? Would it be better practice if I <code>session_write_close</code> every time i'm done with session data? (Though that would mean <code>session_start</code>ing everytime i'd like to use a session variable).</p>