title: Run perl file from PHP script but not wait for output on Windows Server
body: <p>Im trying to execute a perl script from within a php script.  I have had this working using various methods such as exec, popen and proc_open but I have a couple of issues to get around which the good old Google isnt giving me the answers to.</p>
  
  <p>I need to run the .pl script (passing one variable to the script which is a number) from within the php file but stop the php script from waiting until the .pl has finished (the .pl is likely to take 4-5 hours to run on the server). Im not expecting any return output from the perl script (the perl script logs its output to a mysql db) so I just need it to be running on the server and let the php script carry on.</p>
  
  <p>There are some barriers to get past as its running on a Windows machines running apache, php, mysql.</p>
  
  <p>I think Ive seen the solution for linux but it needs to stay on the Windows machine.  </p>
  
  <p>Im current trying a proc_open approach using the following code (the 35 on the proc_open line is a test id I need to pass to the perl script):</p>
  
  <pre><code>$descriptorspec = array(
  0 =&gt; array("pipe","r"),
  1 =&gt; array("pipe","w"),
  2 =&gt; array("file","./error.log","a")
  ) ;
  
  proc_close(proc_open('perl perlscript.pl 35', $descriptorspec, $pipes));
  
  $i = 0;
  while ($i &lt; 1000) {
     echo ++$i;  
  }
  </code></pre>
  
  <p>Now this code does execute the perl script but the while loop Ive placed after it (just for testing)  never executes (ive not waited for the perl script to finish to see if it does) as it must be waiting for the .pl to finish.</p>