Re: can't get output of exec ('nice -n 19 ffmpeg -i "file"')

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 29, 2008 at 2:53 PM, Rene Veerman <rene7705@xxxxxxxxx> wrote:
> Hi, i have the following php statements;
>
> I'm wondering why exec()'s $output remains empty..
> Any help is greatly appreciated..
>
> <?php
>   $cmd = 'nice -n 19 ffmpeg -i "'.$sourcePath.'"';
>   exec ($cmd, $output, $result);
> return array (
>           'cmd' => $cmd,
>           'output' => $output,
>           'result' => $result
>   );

    Try this instead, just to make sure everything's running as expected:

<?php
 $cmd = 'nice -n 19 ffmpeg -i "'.$sourcePath.'" 2>&1';
 exec($cmd,$ret,$err);
 print_r($ret);
?>

    $ret (or whatever you name the second parameter of exec()) will
always be an array, regardless of the actual output from the command.

    You'll need to be sure you have shell access and the ability to
execute system commands as whatever user the PHP script is running
(your own user, apache, httpd, nobody, daemon, pscln, etc.).

    Redirecting the error channel to stdout (using the 2>&1 redirect
at the tail of the command) will also give you the full program
response on $ret, which is then dumped in full using print_r() as
shown above.

-- 
</Daniel P. Brown>
More full-root dedicated server packages:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux