Does anybody know why these functions would not work? PHP is running as the same user I was using for SSH, so it isn't that. Any other suggestions?
Trying to use shell_exec, exec, system, passthru, etc.
Moderator: General Moderators
Trying to use shell_exec, exec, system, passthru, etc.
I'm attempting to use a library called "ffmpeg" to convert mpeg files to flv on the fly when users upload them. I have downloaded and installed "ffmpeg" on my server and when I use it over ssh, it works exactly as expected. But for some reason, when I try the same exact command using "exec()", "shell_exec()", "system()", the back-tick operator, etc. it doesn't work.
Does anybody know why these functions would not work? PHP is running as the same user I was using for SSH, so it isn't that. Any other suggestions?
Does anybody know why these functions would not work? PHP is running as the same user I was using for SSH, so it isn't that. Any other suggestions?
Re: Trying to use shell_exec, exec, system, passthru, etc.
It's probably permissions. Are you sure PHP is running as the same user? it usually runs as apache or nobody
Re: Trying to use shell_exec, exec, system, passthru, etc.
Try
Code: Select all
echo `/full/path/to/ffmpeg ..... 2>&1`;There are 10 types of people in this world, those who understand binary and those who don't
Re: Trying to use shell_exec, exec, system, passthru, etc.
Well, I ran "passthru('whoami')" inside PHP and it output "tvmed".pytrin wrote:It's probably permissions. Are you sure PHP is running as the same user? it usually runs as apache or nobody
Re: Trying to use shell_exec, exec, system, passthru, etc.
Forgive my ignorance, but what parts of that do you mean literally and what parts do you mean to replace args etc. with? Did you mean something like:VladSun wrote:TryCode: Select all
echo `/full/path/to/ffmpeg ..... 2>&1`;
Code: Select all
echo `/usr/local/bin/ffmpeg '/path/to/file.mpeg' '/path/to/file.flv'`Re: Trying to use shell_exec, exec, system, passthru, etc.
Code: Select all
echo `/usr/local/bin/ffmpeg '/path/to/file.mpeg' '/path/to/file.flv' 2>&1`;There are 10 types of people in this world, those who understand binary and those who don't