RE: [PHP] I think this is a bug...cant use exec commands.
| From: | Brian Duke | Date: | Fri, 02 Apr 2004 05:57:19 +0000 |
| Subject: | RE: [PHP] I think this is a bug...cant use exec commands. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-182092@lists.php.net to get a copy of this message | ||
I tell you the truth. I have only 1 php.ini. There are other ini files I
have looked at but I have not found anything in them about safe mode.
Everything has been double or triple checked. Still not able run any
shell_exec commands from the command line.
I need the output from free so if I use exec()
<?php
exec("free -b", $data, $result);
$data = str_replace(' ',' ',$data);
$data = str_replace(' ',' ',$data);
$data = str_replace(' ',' ',$data);
$data = str_replace(' ',' ',$data);
$dataArray = explode(' ',$data);
$total = $dataArray[16];
$used = $dataArray[17];
echo $used.chr(10);
echo $total.chr(10);
?>
Exec complains that "free" is not in /usr/local/php/bin/ directory. ( I
think that's the directory but whatever it was, it wasn't pointing at the
web directory where my script is.) Really someone should try this script.
It's harmless. 'Free' is a nix command.
And BTW
[snip from original]
> Warning: shell_exec(): Cannot execute using backquotes in Safe Mode in
> /var/www/html/swap/mem.php on line 3
[/snip]
Is how that line should read. The complaint is about the script I an\m
running called mem.php. Originally named swap.php. I wasn't paying close
enough attention when I cut from the bugs.php.net page and pasted. :)