PHP - shell_exec output in browser is empty

I run a simple command wgetinshell_exec()

wget_file.php

<?php
$command = "wget http://mydomain.co/media/bigbigbig.wav";
$output = shell_exec($command);
echo $output;
?>

According to http://www.php.net/shell_exec I can expect an exit: "Exit from the executed command or NULL if an error occurs, or the command does not display the result."

If I run wget_file.php from the command line, I will see the display of wget results. However, if I run it from a browser, there will be no result. (but the file does load successfully)

I plan to execute wget_file.php by calling through cUrl, passing the url + path. But it would be nice to get a response from shell_exec()after completion.

Does anyone know if I just missed something to get the result (works in the browser)?

+4
1

wget_file.php , wget

wget , , , .

, STDERR, STDOUT, STDOUT, shell_exec PHP :

  • script , , ; , wget, PHP ;

  • Apache - , .

:

$command = "wget http://mydomain.co/media/bigbigbig.wav 2>&1";

shell_exec , , — er — !

+7

All Articles