2009/09/16

phpのバックグラウンドで外部処理を実行する

ここを参考にhttp://www.stackasterisk.jp/tech/php/php02_02.jsp


system("/home/user/sh/convert.php $arg1 $arg2 > /dev/null &");


「> /dev/null &」をバックグランドで処理を実行することになる。

通常処理はこっち。

system("/home/user/sh/convert.php $arg1 $arg2 &");

これだとconvert.phpの処理に1分かかったら、レスポンスも1分待たないといけない。