PHP exec() problem - qmail-qstat returns -1
Hi,I am trying to write a php script that can execute qmail-qstat to return the amount to emails in the queue.
I have written the following code:
exec('/var/qmail/bin/qmail-qstat',$output,$ret);
foreach ($output as $line)
{
echo ("$line<Br>");
}
which returns this output:
messages in queue: -1 messages in queue but not yet preprocessed: -1
Why is it displaying -1, when it should be showing 26 as the first number and 0 as the second (as it does with ssh)
I've tried changing the code to use the other similar functions (ie system()) and to output the result to a file, etc., but I still get the same result.
Can anyone help?