Hello,
I created a file called "convnow.sh" that converts multimedia files wmv to mpg and then mpg to avi. I use mencoder to convert wmv to mpg and ffmpeg to convert mpg to avi... so, when I run convnow.sh from console it runs mencoder and ffmpeg ok and converts the files as I want, and if I take commands from .sh file and type them in console one by one they also convert the files fine.
The problem is that if I call this "convnow.sh" file from a PHP page it only executes the mencoder command, the ffmpeg command seems not be executed for some reason. What I don't understand is why mencoder is executed and ffmpeg is not. I made a "ls -l" to see the user group/user name and they are the same "root:root". Another thing that could be important is that It seems that PHP uses user "apache", when I execute a "whoami" command.
Here is the PHP code that calls the "convnow.sh", the mencoder is executed but the ffmpeg isn't:
Quote:
$command1="sh ./convnow.sh";
function syscall($command){
if ($proc = popen("($command)2>&1","r")){
while (!feof($proc)) $result .= fgets($proc, 1000);
pclose($proc);
return $result;
}
}
$results=syscall("$command1");
|
I tried to execute ffmpeg only from the PHP page but I don't get any result, here is the code:
Quote:
$command1="ffmpeg -i ea.mpg out.avi";
function syscall($command){
if ($proc = popen("($command)2>&1","r")){
while (!feof($proc)) $result .= fgets($proc, 1000);
pclose($proc);
return $result;
}
}
$results=syscall("$command1");
print "$results";
|
If I use shell_exec it says "It doesn't work" normally it should, because in the command line it does:
Quote:
$command1="ffmpeg -i ea.mpg out.avi";
echo shell_exec($command1) or die("It doesn't work");
|
Any help would be apreciated.
Regards,
Darkisolde