[英]sh: /usr/bin/ffmpeg: not found
我正在嘗試使用shell_exec或exec從PHP執行ffmpeg,但它失敗了。 為什么會這樣? 命令/usr/bin/ffmpeg
在終端上運行,所以我試過了
<?php
$cmd = "/usr/bin/ffmpeg";
exec($cmd." 2>&1", $out, $ret);
if ($ret){
echo "There was a problem!\n";
print_r($out);
}else{
echo "Everything went better than expected!\n";
}
?>
而且我繼續得到
There was a problem! Array ( [0] => sh: /usr/bin/ffmpeg: not found )
任何幫助將不勝感激。
可執行文件的權限是
-rwxr-xr-x 1 root root 106552 Jun 12 09:53 ffmpeg
which /usr/local/bin/ffmpeg
到$ cmd中將返回一個空數組。
您的問題的答案可能比預期的簡單。 您正在檢入/usr/local/bin
和 /usr/bin
。 有多種解決方案。
你可以運行$ whereis ffmpeg
,看看你得到了什么。 根據結果,更改$cmd
變量。 如果whereis
什么都沒有返回,那么你的系統不知道它在哪里。 您可以將其添加到$PATH
環境變量中,然后重試。
您可以嘗試運行$ find /usr -name "ffmpeg"
或類似的東西。 通過確保安裝此程序,它將幫助您更快地解決此問題。
如果存在某種限制,拒絕apache訪問/使用ffmpeg的能力,您可以始終將其存儲在文檔根目錄中的bin文件夾中。 (比如/ path / to / doc / root / bin / ffmpeg )之前我已經這樣做了所以我知道它有效。
如果您發現ffmpeg實際位於/usr/local/bin
那么您應該嘗試將$cmd
更改為:
$cmd = '/usr/local/bin/ffmpeg';
有一個問題!
Array (
[0] => FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
[1] => built on Jan 29 2012 17:52:15 with gcc 4.4.5 20110214 (Red Hat 4.4.5-6)
[2] => configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64
--mandir=/usr/share/man --incdir=/usr/include --disable-avisynth
--extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC'
--enable-avfilter --enable-avfilter-lavf --enable-libdc1394 --enable-libdirac
--enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora
--enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads
--enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
[3] => libavutil 50.15. 1 / 50.15. 1
[4] => libavcodec 52.72. 2 / 52.72. 2
[5] => libavformat 52.64. 2 / 52.64. 2
[6] => libavdevice 52. 2. 0 / 52. 2. 0
[7] => libavfilter 1.19. 0 / 1.19. 0
[8] => libswscale 0.11. 0 / 0.11. 0
[9] => libpostproc 51. 2. 0 / 51. 2. 0
[10] => Use -h to get full help or, even better, run 'man ffmpeg'
[11] => Hyper fast Audio and Video encoder
[12] => usage: ffmpeg [options] [[infile options] -i infile]...
{[outfile options] outfile}...
[13] =>
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.