如何在php中启动wine shell_exec("wine ffmpeg.exe");
?
(ubuntu 版本 14 服务器)
安装
sudo apt-get install wine -y
php5代码:
$cmd = "/usr/bin/wine /var/www/html/ffmpeg.exe upload/image.jpg"
shell_exec($cmd);
ffmpeg.exe
地点:/var/www/html/
wine is not starting?
Linux version of FFmpeg?, how to run PHPshell_exec()
?
服务器域不在共享主机上
对
www-data
的权限可能有问题?在终端中成功命令ffmpeg!
存在权限问题,刚刚测试过,命令是正确的。
ffmpeg.exe 或 wine 的权限不正确。
命令 (ffmpeg.exe)
chmod 755 ffmpeg.exe
chown www-data ffmpeg.exe
命令(/usr/bin/wine)
chmod 755 wine
chown www-data wine
sudo service apache2 restart
仍然无法正常工作,可能需要更多“葡萄酒”文件来应用权限。
我无法输出任何错误,从终端到 ffmpeg 的命令是正确的,问题必须是权限
最佳答案
首先,为您的服务器下载并安装 FFmpeg: https://www.ffmpeg.org/download.html ,是的,有适用于 Linux 的版本。
然后,最好使用 exec() 并在后台运行 ffmpeg,这样您就不必等到视频转换到另一个页面。
$cmd = 'ffmpeg -- parameters here --';
// 2>&1 is used for execute on background
exec("$cmd 2>&1", $output);
// Do you need to debug?
// See ffmpeg results:
var_dump($output);
关于php - 在 ubuntu 版本 14 中设置权限 (PHP5) shell_exec ("wine ffmpeg.exe"),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45383770/