title: PHP on a windows machine; Start process in background
body: <p>I'm looking for the best, or any way really to start a process from php in the background so I can kill it later in the script.</p>
  
  <p>Right now, I'm using: shell_exec($Command);
  The problem with this is it waits for the program to close.</p>
  
  <p>I want something that will have the same effect as nohup when I execute the shell command. This will allow me to run the process in the background, so that later in the script it can be closed. I need to close it because this script will run on a regular basis and the program can't be open when this runs.</p>
  
  <p>I've thought of generating a .bat file to run the command in the background, but even then, how do I kill the process later?</p>
  
  <p>The code I've seen for linux is:</p>
  
  <pre><code>$PID = shell_exec("nohup $Command &gt; /dev/null &amp; echo $!");
  // Later on to kill it
  exec("kill -KILL $PID");
  </code></pre>
  
  <p><strong>EDIT</strong>: Turns out I don't need to kill the process</p>