我在php中使用shell_exec()运行shell脚本(运行C程序),但程序未运行且生成的输出不完整。
php文件:
<?php
$output =passthru('./heatmap -vid cctv5.mp4 2>&1');
echo $output;
var_dump($output);
echo "Done with Heatmap";
?>
shell_exec()的输出
This program shows how to use background subtraction OpenCV videos (-vid) and images (-img). Usage: ./bs {-vid
终端输出:
This program shows how to use background subtraction
OpenCV videos (-vid) and images (-img).
Usage:
./bs {-vid <video filename>|-img <image filename>}
for example: ./bs -vid video.avi
or: ./bs -img /data/images/1.png
-----------------------------------------------------
Number of Frames: 6866; FPS: 29.97
MIN: 0; MAX: 15.6861
MIN: 0; MAX: 255
Channels:firstframe: 3; Channels:display: 3
Time taken: 1.23121
Time taken per frame: 0.00432003
我尝试了 exec(),passthru(),但没有人能够运行该程序,并且所有人都生成相同的不完整输出。