PHP exec()无法与ffmpeg一起使用 [英] PHP exec() Not Working With ffmpeg

查看:71
本文介绍了PHP exec()无法与ffmpeg一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在PHP(在Ubuntu上)上运行以下命令:

I'm attempting to run the following command in PHP (on Ubuntu):

<?php
 if (exec("/home/johnboy/ffmpeg/ffmpeg -i test1.mp4 -acodec aac -ab 128kb -vcodec mpeg4 -b 1220kb -mbd 1 -s 320x180 final_video.mov")) 
      { echo "Success"; }
      else { echo "No good"; }

我总是得到不好"的回声,并且没有创建文件.

And I always get "No good" echoed back, and no file created.

有趣的是,如果我在Shell中运行相同的确切命令,它将正常工作,没问题.

Interestingly, if I run the same exact command in Shell, it works, no problems.

此外,当我运行上面的相同代码,但是用"whoami"代替ffmpeg的东西时,它也可以工作.(它回显成功")

Also, when I run the same code above, but subsitute "whoami" instead of the ffmpeg stuff, it works. (It echoes back "Success")

关于为什么这样不起作用的任何想法?谢谢.

Any ideas on why this wouldn't be working? Thanks.

推荐答案

apache/网络用户能否访问/home/johnboy/ffmpeg/ffmpeg ?也就是说,也许/home/johnboy 是0700而不是0755?

Can the apache/web user reach /home/johnboy/ffmpeg/ffmpeg? That is, perhaps /home/johnboy is 0700 instead of 0755?

也许有资源限制会影响如此大程序及其所有库的加载?

Perhaps there are resource limits affecting loading of such a large program and all its libraries?

如果将脚本运行到php cli sapi,它的行为是否正确?即使以apache用户身份运行?

If you run the script to the php cli sapi, does it behave correctly? Even when running as the apache user?

当apache网络用户通过php cli运行php脚本时, strace -ff 显示什么?

What does strace -ff show when the apache web user runs the php script through the php cli?

这篇关于PHP exec()无法与ffmpeg一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆