PHP exec()ログ出力

558 ワード

一、
$commandString = 'you_command_here >> log_file.log 2>&1 &';
$command = exec($commandString);

二、
$cmd = '/usr/local/bin/ffmpeg -i http://m.bcb.cn:8134/vod/3min/2015/201504211621.mp4 -ss 00:00:10 -vframes 1 -f image2 image1.jpg >> log_file.log 2>&1 &';

$res = exec($cmd." 2>&1", $out, $ret);
if ($ret){
    echo "There was a problem!
"; print_r($out); }else{ echo "Everything went better than expected!
"; }