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?

Recommended Answers

All 2 Replies

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.

Hi,

$var=0 indicates success in Unix.

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

Svet

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.