I hava a simple php script like this
<?php
exec('foo you 2>&1', $output, $return_val);
print_r($output);
execute it on command line it gives out
Array
(
[0] => sh: foo: command not found
)
but when I place it under a web server document directory and access it from browser it shows
Array ( )
I use nginx+phpfpm and server config is right.
As you see, I have redirect error from stderr to stdout. And more, the return_var is -1
.
So the problem is that why it returns empty when accessed from browser while it is normal when executed on command line.
Thanks.