[英]php exec() works on some calls, not other similar ones
I have a php script that cuts up video. 我有一个PHP脚本,可以减少视频。 Here are three exec() commands - two execute properly while one does not:
这是三个exec()命令-两个正确执行,而一个则不执行:
Works: 作品:
sudo ffmpeg -i /home/vidserver/videos/$filename.mp4 -ss $ctime -t 00:00:06 -acodec copy -vcodec copy -y /var/vidcache/test$x.mp4
sudo ffmpeg -i /home/vidserver/videos/$filename.mp4 -ss $ ctime -t 00:00:06 -acodec复制-vcodec复制-y /var/vidcache/test$x.mp4
Works: 作品:
sudo ffmpeg -i /var/vidcache/test$x.mp4 -qscale:v 1 /var/vidcache/i$x.mpg
须藤ffmpeg -i /var/vidcache/test$x.mp4 -qscale:v 1 /var/vidcache/i$x.mpg
Does not work: 不起作用:
sudo ffmpeg -i concat:"i0.mpg|i1.mpg" -qscale:v 1 /var/vidcache/output.mpg
sudo ffmpeg -i concat:“ i0.mpg | i1.mpg” -qscale:v 1 /var/vidcache/output.mpg
/var/vidcache has 777 privs and www-data
is in the sudoers file with NOPASSWD (yes, I know - this is just for debug purposes before I lock down security). / var / vidcache具有777 privs,而
www-data
位于带有NOPASSWD的sudoers文件中(是的,我知道-这只是在调试之前锁定安全性)。
When I run the last command from a php script from the command line by itself, it DOES work. 当我从命令行本身通过php脚本运行最后一个命令时,它确实起作用。 (Running as www-data or root.) But when I try to put it in a function called from a web page, it does NOT work.
(以www-data或root身份运行。)但是,当我尝试将其放在从网页调用的函数中时,它将不起作用。
Any ideas? 有任何想法吗?
Actually, the answer was as stupid as "where does www-data know where to look for files?" 实际上,答案是愚蠢的,例如“ www-data在哪里知道在哪里寻找文件?”
I was assuming a lot with the i0.mpg. 我对i0.mpg承担了很多责任。 It needs a fully qualified directory, obviously.
显然,它需要一个完全合格的目录。
Anyway, changing the code to look like this worked: 无论如何,更改代码使其看起来像这样:
sudo ffmpeg -i concat:"/var/vidcache/i0.mpg|/var/vidcache/i1.mpg" -qscale:v 1 /var/vidcache/output.mpg
sudo ffmpeg -i concat:“ / var / vidcache / i0.mpg | /var/vidcache/i1.mpg” -qscale:v 1 /var/vidcache/output.mpg
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.