Re: PHP Uptime error
| From: | Richard Lynch | Date: | Mon, 25 Jun 2001 07:34:58 +0000 |
| Subject: | Re: PHP Uptime error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55112@lists.php.net to get a copy of this message | ||
> I have a PHP script with the following code in it;
>
> $uptime = passthru ("/usr/bin/uptime");
>
> but when I load the PHP page I get the following;
>
> 8:26pm up 0 min, 0 users, load average: 0.00, 0.00, 0.00
>
> which is wrong (I have checked the uptime via telnet). Can anybody please
> help me try and fix this?
When you checked uptime via telnet, were you logged in as "nobody", or
whomever PHP runs as?... If not, you haven't really duplicated the
circumstances where PHP exists.
I can't think why "nobody" wouldn'y be allowed to do "uptime", but
maybe
there's some security issue involved. Too bad those load numbers aren't
right though :-)
You may have to resort to creating a suid shell script with some "real" user
as owner for PHP to be able to run it to do uptime. See "man suid" for
details.
BE CAREFUL. A mis-configured suid script is a security risk. Actually,
that's like saying a sucking chest wound is a "cut" :-^
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm