title: Running a script from another script with session data
body: <p>I am trying to have a script start another script and put its data into a session variable for the other script to use. The problem is that when the second script, data.php, runs it doesn't seem to be able to access the session variables. They are blank and nothing gets written to data.txt. If I run data.php by itself it writes the last value that <code>$_SESSION["data"]</code> was set to properly, but not when it's run with exec. I am not sure what the problem is. Any ideas?</p>
  
  <p>input.php:</p>
  
  <pre><code>session_start();
  $_SESSION["data"] = "Data!";
  exec("/usr/bin/php /path/to/data.php &gt; /dev/null 2&gt;&amp;1 &amp;");
  </code></pre>
  
  <p>data.php:</p>
  
  <pre><code>session_start();
  $fp = fopen('data.txt', 'w');
  fwrite($fp, $_SESSION["data"]);
  fclose($fp);
  </code></pre>
  
  <p>Edit: I am trying to start data.php from inside input.php and have the variables from input.php accessible in data.php.</p>