title: How can I start a process with paramaters without waiting for it to finish and get it's PID in PHP?
body: <p>So I start a process to open a process and kill the first one so this way it can run in the background, but I don't know how to get the PID of the process that I started the second time. I'm sure that there is another method for running a process in the background and getting it's PID.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>function execInBackground($cmd) {
          if (substr(php_uname(), 0, 7) == "Windows"){
            pclose(popen("start /B ". $cmd, "r")); 
          }
      else {
          exec($cmd . " &gt; /dev/null &amp;");  
      }
  }
  
  execInBackground('start ' . getcwd() . '\\nskip\\run.bat ' . $_SESSION["user"]);
  </code></pre>