[英]FFmpeg permission denied CENTOS - PhpVideoToolKit
我正在嘗試執行此PHP代碼
exec("/root/bin/ffmpeg -version 2>&1", $output); print_r($output);
但始終會拒絕輸出返回權限
Array ( [0] => sh: /root/bin/ffmpeg: Permission denied )
和庫PhpVideoToolKit的輸出
sh: /root/bin/ffmpeg: Permission denied
我如何授予執行我的apache服務的權限? 我用過CENTOS
好吧,首先在Centos OS中,我們需要讓apache或www-data權限執行:
編輯sudoers
nano /etc/sudoers
注釋requiretty行
#Defaults requiretty
在文件的末尾添加一行
apache ALL=(ALL) NOPASSWD: ALL
現在我們可以通過PHP執行命令
exec('sudo /root/bin/ffmpeg -v',$output);
print_r($ouput);
輸出是
Array (
[0] => ffmpeg version git-2016-07-03-1ad4471 Copyright (c) 2000-2016 the FFmpeg developers
[1] => built with gcc 4.1.2 (GCC) 20080704 (Red Hat 4.1.2-55) ...
就是這樣!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.