ねえ、私は最近proc_openをたくさん使っています、そしてそれは次に進む前にそれが終わるのを決して待ちません。空のarray()を使用するだけでなく、パイプを指定するようにしてください
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to write to
);
また、proc_openを変数に割り当てます。
$myProc = proc_open("/var/www/other_scripts/perl/apps/emails_extract_from_url.pl \"$stoopid\"", $descriptorspec , $foo)
次に、を使用してプロセスのステータスを取得できます。proc_get_status($myProc);
詳細はこちらhttp://au.php.net/proc_open
クロージングに関する詳細情報。
$temp = fgets($this->open_pipes[$thread_id][1], 1024);
if($this->checkFinishedThread($thread_id))
{
fclose($this->open_pipes[$thread_id][1]);
proc_close($thread);
}
function checkFinishedThread($thread_id)
{
$test = stream_get_meta_data($this->open_pipes[$thread_id][1]);
if($test['eof'] == 1)
return true;
return false;
}