From 6b76c57303b432a22dc5df51fe5cd6af6f73c79d Mon Sep 17 00:00:00 2001 From: xfra35 Date: Mon, 21 Dec 2015 12:39:31 +0100 Subject: [PATCH] Better async detection --- lib/cron.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/cron.php b/lib/cron.php index ffd2518..b9598dd 100644 --- a/lib/cron.php +++ b/lib/cron.php @@ -202,8 +202,10 @@ function __construct() { if (isset($config['presets'])) foreach($config['presets'] as $name=>$expr) $this->preset($name,is_array($expr)?implode(',',$expr):$expr); - if (function_exists('exec') && exec('php -r "echo 1+3;"')=='4') - $this->async=TRUE; + if (function_exists('exec')) { + exec('php -v 2>&1',$out,$ret); + $this->async=$ret==0;// check if the `php` binary is in the path and can be executed + } $f3->route(array('GET /cron','GET /cron/@job'),array($this,'route')); }