behnamy - 2015-09-25 19:25:31
Hi martin, I created my script some weeks ago and used your package in it, and my developing environment was windows, So I couldn't check if your codes are working correctly or not, and I was hoping that it will work in my production environment(Centos 7 with Directadmin).
But today I tested it and it doesn't work in my server, and when I add it to cron jobs, an email sends to me to that some functions are disabled in my server!
I thought it is because of some functions like pcntl that you used in your codes, so I enabled pcntl module, but it is not working yet.
I think the problem is in these below lines:
foreach ($jobs as $job) {
$pid = pcntl_fork();
if (! $pid) {
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w")
);
$process = proc_open($job['cmd'], $descriptorspec, $pipes);
if (is_resource($process)) {
echo $procout = stream_get_contents($pipes[1]);
echo $procerror = stream_get_contents($pipes[2]);
fclose($pipes[1]);
fclose($pipes[2]);
$return_value = proc_close($process);
}
break;
}
}
_____________________________
would you tell me what's wrong with your codes/my server or is it possible that you add another way for execute jobs instead of pcntl/proc functions? for example check if pcntl function is not available then executing jobs with another method!