RE: [PHP-DEV] Bug #3867: Exec() no longer returns the command output line From: Mike Robinson (mgrphp3 <email protected>)
Date: 03/18/00

>From: mlemos <email protected>
>Operating system: Linux RH 6.0
>PHP version: 3.0.15
>PHP Bug Type: Misbehaving function
>Bug description: Exec() no longer returns the command output line

>The Exec() command no longer returns the command output line
>like it used to until the version 3.0.14. Try this:

><?

>echo Exec("pwd"),"\n";

>?>

Hmmm.

>From the manual...

"string exec(string command, string [array], int [return_var]);

exec() executes the given command, however it does not output anything."

<snip>

"If the array argument is present, then the specified array will be filled
with every line of output from the command."

<snip>

So... echo exec("pwd") would output nothing, as stated. However, if I
execute the following script in the /home/httpd/html directory:

<?php

Exec("pwd",$result);
echo "$result[0]\n";

?>

the output is "/home/httpd/html", as expected.

I may be hallucinating, but I've never known exec() to
output anything, unless the output is dumped to the array
specified in the second argument.

>This bug also shows in PHP 4.0b4pl1.

The behaviour is the same I agree. I believe it's the expected
behaviour.

/mike

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>