Running lame from php
I am trying to run lame from a php script.
I tried this but no luck, I got nothing! Any ideas?
system('lame', $returnarr);
system('lame --help', $returnarr);
exec('lame', $returnarr);
passthru('lame', $returnarr);
even this one returns nothing:
exec('which lame', $returnarr);
I'm on OSX and the final deployment will be on Linux. Do you have any better suggestions for automatic wav-> mp3 conversion? From php, should I execute a bash script that executes Lame?
a source to share
Try something like this:
$output = array();
$result = -1;
exec('`/usr/bin/which lame` --help 2>&1', $output, $result);
var_dump($output, $result);
$ output should be an array of strings contained in the output file
$ result must be an integer result. 0 is usually successful,> = 1 is error (specific codes vary by application).
Part 2> and 1 will redirect STDERR to STDOUT ($ output) which is usually discarded. So if it's a bug, you should be able to see the error (hopefully).
If you get -1 to dump $ result, there is a fundamental problem because it is the wrong result code (it probably means exec is disabled or the process you are trying to start is restricted due to error permissions or such) ...
a source to share