Shell_exec () and exec () doesn't show output

shell_exec()

:

I am making a PHP site that uses a function shell_exec()

like this:

$file = "upload/" . $_FILES["file"]["name"];

$output = shell_exec("leaf $file");
echo "<pre>$output</pre>";

      

Where sheet is a program that is in the same folder of my script, but when I tried to run this script on the server, I just didn't get anything.


exec()

:

If I try to use exec()

like this:

exec("sh " . getcwd() . "leaf -h", &$output);
echo "<pre>";
print_r(&$output);
echo "</pre>";

      

I got it:

Array
(
)

If I do the same, but using echo

instead print_r

, I only got this:Array

What can I do?

+2


a source to share


1 answer


Have you tried using the full path with your "leaf" link?



$output = shell_exec("/var/local/leaf $file");

      

+2


a source







All Articles