title: execute java program in the background while loading a page using php
body: <p>I am trying to run a java program in the background using php. I am able to the run the program but the page doesn't load till java program completes executing.</p>
  
  <p>I am able to run shell scripts in the background using php. But if i give the same command for java, it doesn't run in the background.</p>
  
  <pre><code>$command = "java hello";
  $outputfile = "out1";
  $pidfile = "out2";
  exec(sprintf("%s &gt; %s 2&gt;&amp;1 &amp; echo $! &gt;&gt; %s", $command, $outputfile, $pidfile));
  </code></pre>
  
  <p>How can i run the program in the background?</p>