title: PHP Background cron job
body: <p>A script has an execution time of more than a minute. So, therefore I would like to run the script as a background task.</p>
  
  <p>I've read a lot about it on the internet and read that <code>print shell_exec('/usr/bin/php -q page.php &amp;');</code> isn't the solution since the taks is still a child of the process. I've tested it with sleep(10) and indeed, the page which should call the cron job is waiting for 10 seconds.</p>
  
  <p>So, symcbean have written an article ( <a href="http://symcbean.blogspot.nl/2010/02/php-and-long-running-processes.html?m=1" rel="nofollow">http://symcbean.blogspot.nl/2010/02/php-and-long-running-processes.html?m=1</a> ) and is suggesting the following code:</p>
  
  <pre><code>print `echo /usr/bin/php -q longThing.php | at now`;
  </code></pre>
  
  <p>But, unfortunately, i script didn't do anything and after adding <code>2&gt;&amp;1</code> I get the following response:</p>
  
  <blockquote>
    <p>sh: at: command not found</p>
  </blockquote>
  
  <p>I've search a lot for solving this issue, but can't find any solution.</p>