1

Hey, I'm trying to execute a program on windows through PHP, the command is posted below. 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
  • 2
    if you put the thing your execing into a variable and echo $var; exec($var); does the echod var definitely work? Commented Mar 15, 2010 at 19:25

4 Answers 4

12
  1. You are missing a space at the end
  2. You should really use escapeshellarg()
Sign up to request clarification or add additional context in comments.

1 Comment

THANK YOU, that space is what was causing the problem. God, sometimes you just need another set of eyes to look over your code. Thanks a ton!
1
exec('C:\ffmpeg -i  ....

this would mean you would have ffmpeg.exe in your C:\ root directory. I think you mean

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

2 Comments

no, it's located in my C root directory for testing purposes. I've also tried what plod suggested
$execvar = 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); debug ($execvar); but there is no value within execvar
0

try running only the command itself without any options and see if that help. moreover try to run something simple first - dir etc.

3 Comments

when I exec dir, it does return results: 8 Dir(s) 549,287,497,728 bytes free
so exec works. there is some problem with the way you have your ffmpeg + options written.
Some processes need elevation and to be run from within the context of a GUI user, not the System, please check the solutions here for a possible answer in case some calls to system work and others don't: stackoverflow.com/questions/5769800/…
0

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

1 Comment

Yes... IUSR_MACHINENAME is a standard Windows system user that IIS uses to execute/access website files by default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.