2017-07-28 138 views
0

如何在php shell_exec(“wine ffmpeg.exe”)中启动wine; ?ubuntu版本14中设置权限(PHP5)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位置: /无功/网络/ HTML/

酒是没有开始?

Linux版本的FFmpeg ?,如何运行PHP shell_exec()?

Server域是不是在共享主机

权限上www-data可能是什么问题?

命令ffmpeg终端成功!

有一个权限问题,只是测试和命令是正确的。
ffmpeg.exe或wine有不正确的权限。

司令部(ffmpeg.exe)

chmod 755 ffmpeg.exe 
chown www-data ffmpeg.exe 

命令(在/ usr/bin中/葡萄酒)

chmod 755 wine 
chown www-data wine 


sudo service apache2 restart

仍无法正常工作,可能是更多的 '酒' 文件将权限应用于。 我不能输出任何错误,并且命令的ffmpeg是从终端正确的问题一定权限

+0

这究竟有五个upvotes和两个最喜欢的明星吗?你“假设”它开始不正确?你为什么要假装什么?当您尝试运行该命令时,是否查看过STDOUT,STDERR或返回值?是的,当然有一个Linux版本的ffmpeg。基本的网络搜索会告诉你。没有什么特别的东西需要通过PHP来运行。请在此之前进行基础研究,并阅读[询问]提出有效问题的提示。 – Chris

+0

(STDOUT)。 $ proc = popen($ cmd,'r'); echo $ proc; =(OUTPUT)资源ID#20 – user235423423424

+0

shell_exec($ cmd,$ output); var_dump($ output); (输出)= NULL – user235423423424

回答

2

所有,下载的第一,为您的服务器安装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); 
+0

这里安装没有错,从终端执行时工作。必须是文件权限,因为ffmpeg和shell_exec运行时没有错误 – user235423423424

+0

将PHP配置为CGI?,也许你需要运行php-cli才能得到这个工作,请检查:** [link](https://stackoverflow.com/questions/566248/cant-execute-php-script-using-php- exec)** – Triby

+0

@ user235423423424,如果你不需要它,你应该避免使用Wine。这里完全不必要。只需使用本地版本的ffmpeg即可。这几乎肯定会更快,使用更少的内存,并产生更少的错误。 – Chris