title: Using session_name() in PHP - Cannot Access Data
body: <p>When I use:</p>
  
  <pre><code>session_name( 'fObj' );
  session_start();
  $_SESSION['foo'] = 'bar';
  </code></pre>
  
  <p>Subsequently loading the page and running:</p>
  
  <pre><code>session_start();
  print_r( $_SESSION );
  </code></pre>
  
  <p>doe not return the session data.</p>
  
  <p>If I remove the session_name(); it works fine.</p>
  
  <p>Does anyone know how to use sessions with a different session name?</p>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>If I run the above code, as two page loads, and then change to:</p>
  
  <pre><code>session_name( 'fObj' );
  session_start();
  print_r( $_SESSION );
  </code></pre>
  
  <p>I can access the data. However, if it will only work if I first load the page without the line:</p>
  
  <pre><code>session_name( 'fObj' );
  </code></pre>