简体   繁体   English

Windows上的PHP exec()无法正常工作

[英]PHP exec() on windows not working

Hey, I'm trying to execute a program on windows through PHP, the command is posted below. 嘿,我正在尝试通过PHP在Windows上执行程序,命令发布在下面。 This doesn't seem to be running through the script at all, even though it works when the command is manually entered into the command prompt. 即使在手动将命令输入到命令提示符下时,此命令似乎也无法在脚本中运行。

exec('C:\\ffmpeg -i ' . $movedfile . ' -acodec aac -ab 128k -vcodec libx264 -fpre C:\\ffmpeg\\share\\ffmpeg\\libx264-hq.ffpreset -crf 22 -threads 0 -wpredp 0' . $convertedfile);

Any suggestions? 有什么建议么?

Thanks! 谢谢!

  1. You are missing a space at the end 您最后缺少空格
  2. You should really use escapeshellarg() 您应该真正使用escapeshellarg()
exec('C:\ffmpeg -i  ....

this would mean you would have ffmpeg.exe in your C:\\ root directory. 这意味着您将在C:\\根目录中拥有ffmpeg.exe I think you mean 我想你是说

exec('C:\ffmpeg\ffmpeg -i  ....

try running only the command itself without any options and see if that help. 尝试仅运行命令本身而不使用任何选项,然后查看是否有帮助。 moreover try to run something simple first - dir etc. 此外,请尝试先运行简单的内容dir等。

Did you check permissions? 您检查权限了吗? Assuming standard configurations, IUSR_MACHINENAME needs read + execute permissions to the executable, any source/output files, and any temporary directories/files 假定为标准配置,则IUSR_MACHINENAME需要对可执行文件,任何源/输出文件以及任何临时目录/文件具有读+执行权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM