I am trying to run the command:

exec("cat ..........", $output, $var);

Basically, cat "any file" returns no contents in $output, and returns 0 in $var. exec("whoami"); returns "apache" in $output and 0 in $var. Any ideas?

P.S. It used to work just fine and then stopped one day. Not sure at all what was changed, and then ended up doing an OS reload because of other non-related issues.


$var=0 indicates success in Unix.

you may would like to add "2 > &1", i.e. redirect STDERR to STDOUT.
cat $XXXX 2 > &1