RE: [PHP] I think this is a bug...cant use exec commands.
| From: | Daevid Vincent | Date: | Fri, 02 Apr 2004 07:50:34 +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-182101@lists.php.net to get a copy of this message | ||
This may seem obvious, but did you try the FULL path to 'free'?
As in exec("/usr/local/bin/free -b", $data, $result);
> -----Original Message-----
> From: Brian Duke [mailto:brian@box201.com]
> Sent: Thursday, April 01, 2004 9:57 PM
> To: 'Jay Blanchard'; 'William Lovaton'; php-general@lists.php.net
> Subject: RE: [PHP] I think this is a bug...cant use exec commands.
>
> 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. :)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>