Re: Memory uses, system stats
| From: | (Richard Lynch) | Date: | Wed, 12 Jul 2000 22:20:46 +0000 |
| Subject: | Re: Memory uses, system stats | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6313@lists.php.net to get a copy of this message | ||
In article <2063DE4A632FD3118A620020AFD2077E373814@EMAILKL>,
MikeH@KATOLIGHT.COM (Mike Hatcher) wrote:
> Hello List,
> Just curious if there's already code out there to view linux system
> processes, memory used etc... written in PHP? If there is could you point
> them to me.
<TT>
<PRE>
<?php
#Untested code:
exec("/usr/bin/top n 1 b", $top, $error);
while (list(,$line) = each($top)){
echo $line, "<BR>\n";
}
if ($error){
echo "OS Error: $error. Usually paths/permissions.<BR>\n";
echo "Who can run top, and where is it?<BR>\n":
exit($error);
}
?>
</PRE>
</TT>
See 'man top' for explanation of 'n 1 b' part.
--
Richard Lynch | If this was worth $$$ to you, buy a CD
US Customer Support Director | from one of the artists listed here:
Zend Technologies USA | http://www.L-I-E.com/artists.htm
http://www.zend.com | (this has nothing to do with Zend,
duh!)