Ever want to find out information about your server like what your current memory usage is? What type of processor you have? Even disk usage? Here are some basic codes that will help you with all of that:
<pre> <b>Uptime:</b> system("uptime"); <b>System Information:</b> system("uname -a"); <b>Memory Usage (MB):</b> system("free -m"); <b>Disk Usage:</b> system("df -h"); <b>CPU Information:</b> system("cat /proc/cpuinfo | grep \"model name\\|processor\""); </pre>
Your server must be a linux server and allow the system() function to be called in php.
Sample output:
Uptime:
21:39:36 up 2 days, 1:08, 0 users, load average: 0.00, 0.00, 0.00System Information:
Linux danserv 2.6.12-10-386 #1 Mon Jun 12 22:04:42 UTC 2006 i686 GNU/LinuxMemory Usage (MB):
total used free shared buffers cached
Mem: 306 293 12 0 147 33
-/+ buffers/cache: 112 194
Swap: 713 9 704Disk Usage:
Filesystem Size Used Avail Use% Mounted on
/dev/hda3 5.2G 919M 4.0G 19% /
tmpfs 154M 0 154M 0% /dev/shm
tmpfs 154M 13M 141M 9% /lib/modules/2.6.12-10-386/volatile
/dev/hda1 67M 19M 45M 30% /boot
/dev/hdb1 74G 56G 14G 81% /filesCPU Information:
processor : 0
model name : VIA Nehemiah
*The above was taken from my local testing server so you could see a sample output.
Enjoy!




February 16th, 2008 at 7:16 am
Thanks again . i sure like this one . come to find out the server im on . i dident realize has 7 cpu’s running @ 1.6 ghz
. is there more code that can pull more info from the server ?
Thanks again
June 26th, 2008 at 1:54 am
Thanks for sharing this another good script. i used it to display information on pages, which looks good.