php - How to get an output from exec? -
i tried different variations of exec
:
exec('which ffmpeg', $output, $e); exec("which ffmpeg", $output); exec('which ffmpeg 2>&1', $output, $e); exec('echo "which ffmpeg" 2>&1', $output, $e); $output = exec('which ffmpeg');
but no luck.
in console:
[root@gs01]# ffmpeg /usr/local/bin/ffmpeg
pass array second argument exec()
method:
$output = array(); exec('which ffmpeg', $output); var_dump($output);
if output argument present, specified array filled every line of output command. trailing whitespace, such \n, not included in array. note if array contains elements, exec() append end of array. if not want function append elements, call unset() on array before passing exec().
for more information check manual.
php > $a = array(); exec('which ffmpeg', $a); var_dump($a);
returns:
array(1) { [0] => string(15) "/usr/bin/ffmpeg" }
Comments
Post a Comment