Çocuk süreç idam edilecek kadar üzerinde daha fazla kontrol için, proc_open() işlevini kullanabilirsiniz:
$cmd = 'Scripts/script.sh';
$cwd = 'Scripts';
$spec = array(
// can something more portable be passed here instead of /dev/null?
0 => array('file', '/dev/null', 'r'),
1 => array('file', '/dev/null', 'w'),
2 => array('file', '/dev/null', 'w'),
);
$ph = proc_open($cmd, $spec, $pipes, $cwd);
if ($ph === FALSE) {
// open error
}
// If we are not passing /dev/null like above, we should close
// our ends of any pipes to signal that we're done. Otherwise
// the call to proc_close below may block indefinitely.
foreach ($pipes as $pipe) {
@fclose($pipe);
}
// will wait for the process to terminate
$exit_code = proc_close($ph);
if ($exit_code !== 0) {
// child error
}