Hello,
I'm new to running exec commands on php.
I've had ffmpeg installed on my server, at /usr/local/bin/ffmpeg (a cmd line video decoder). It's a linux server.
From looking around the internet, I came up with this code to run it:
shell_exec("/usr/local/bin/ffmpeg -i /home/urieilam/www/work/video/subbed.mov -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 /home/urieilam/www/work/video/test.fla");
It's not working.
I'm running the code from within /home/urieilam/www/work/video/, is that the mistake? Do I have to add some code to move back to the root directory? If so, what is it?
I've also tried "exec" instead of "shell_exec", hasn't worked either.
Unfortunately, I don't have direct Shell/SSH access, so placing the php code in the root would be a problem (i think).
Anyone know about this stuff? The documentation I've been able to find is pretty lacking.
Thanks
Uri
exec and shell_exec
Moderator: General Moderators
Try passthru()
Try using passthru() instead of exec() for now, as it will pass you the raw output from the command line, so you can troubleshoot. There are many potention reasons for it 'not working', with permissions at the top of the list. You will most likely need to change the the permissions, group, or owner of ffmpeg.
You should research the most secure solution to this, as I don't know the answer. I found this link (http://onlamp.com/pub/a/php/2003/02/06/ ... tions.html), it is a good start.
Hope this helps.
UPDATE: Actually you want Part 2 of that tutorial, sorry (http://www.onlamp.com/pub/a/php/2003/04 ... urity.html)
You should research the most secure solution to this, as I don't know the answer. I found this link (http://onlamp.com/pub/a/php/2003/02/06/ ... tions.html), it is a good start.
Hope this helps.
UPDATE: Actually you want Part 2 of that tutorial, sorry (http://www.onlamp.com/pub/a/php/2003/04 ... urity.html)
- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
Before going too deep, try to execute simple things like
etc etc...
If they works and then you have to do next steps like checking the file ownership, command parameters you are passing. Before going to next step, just try to execute that program like
If this works then you have problem in parameters or ownership.
Hope these steps will help you.
Cheers,
Dibyendra
Code: Select all
print shell_exec("ls -lth");
print exec("whoami");
If they works and then you have to do next steps like checking the file ownership, command parameters you are passing. Before going to next step, just try to execute that program like
Code: Select all
exec("/usr/local/bin/ffmpeg")Hope these steps will help you.
Cheers,
Dibyendra