title: How can I enforce a time limit on a call to `exec()`?
body: <p>I'm trying to make an online judge written PHP. My code currently looks like:</p>
  
  <pre><code>exec("gcc /var/www/qwerty.c -o /var/www/binary",$output,$returnval);
  print_r($output);
  exec("cat /var/www/qwe.txt | /var/www/binary",$output,$returnval);
  print_r($output);
  </code></pre>
  
  <p>However, I want each process spawned by <code>exec</code> to have at most 1 second to run. I'm not sure how to do this.
  set_time_limit() isn't working</p>