title: PHP: How to use session on one page while another page with session is loading
body: <p>I am using CURL to download a large file from an external url and save it on my server.
  This can take up to few minutes.
  While the download is running I'm using the curl_setopt($ch, CURLOPT_PROGRESSFUNCTION,.. to run anonymous function which periodically updates my $_SESSION['download_progress'] variable  with current download info.</p>
  
  <p>Now, all this is happening in upload.php file and while the user is waiting for the file to download I use javascript to request progress.php page which contains the following simple code:</p>
  
  <pre><code>session_start();
  echo $_SESSION['download_progress'];
  </code></pre>
  
  <p>This allows my javascript code to display information about the download progress.</p>
  
  <p>Except it's not working.</p>
  
  <p>The "progress.php" page won't load until the "upload.php" finished loading (in other words both pages load only after the file finished downloading) and this, is not good.
  The session_start() somehow blocks the "progress.php" page from loading.
  I use my own server (apache + php 5.4) so I have all admin rights.</p>
  
  <p>How can I solve this problem?
  I could use some ugly workaround, like writing the download information into a  text file instead of session variable and then use the javascript to directly read that text file, but I would rather not do that.</p>
  
  <p>Thanks</p>