Bug #8652 Updated: exec and system always return -1
| From: | sniper@php.net | Date: | Sat, 12 May 2001 01:11:49 +0000 |
| Subject: | Bug #8652 Updated: exec and system always return -1 | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-54942@lists.php.net to get a copy of this message | ||
ID: 8652
Updated by: sniper
Reported By: simon.king@pipinghotnetworks.com
Old-Status: Duplicate
Status: Closed
Bug Type: Program Execution
Operating system:
PHP Version: 4.0.4
Assigned To:
Comments:
Fixed in CVs.
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2001-01-15 08:45:10] cynic@php.net
duplicate of #8466
---------------------------------------------------------------------------
[2001-01-11 07:31:37] simon.king@pipinghotnetworks.com
<?
function run_command($command, $errmsg) {
$lastline = exec("$command 2>&1", &$lines, $rc);
if ($rc) {
print("<pre>n");
print("$errmsgnn");
print("Command : $commandnReturned : $rcnOutputn------n");
print(join("n", $lines)."nn");
}
return($rc);
}
$rc = run_command("/bin/uname -a", "Uname Failed!");
print("rc now = $rc");
?>
All the commands that I have tested (uname is just an example) have returned -1 as the return code,
even though the command has executed perfectly well. I get the same error if I use system instead of
exec. I cannot see how else to run a command and check to see whether it failed or not.
I am using PHP RPMS downloaded from http://rpms.arvin.dk/php/ but this does not seem like a
packaging error, so I am reporting it here.
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=8652&edit=2