This block makes it possible to show the current load and uptime in a block. The code will not work as is on all Unixes. One might consider it a security risc to show what your uptime is (kernel patching requires reboot), so .. batteries not included, always look both sides when crossing a road etc.
You can learn from this code how to execute shell commands form php.
$uptime = shell_exec("cut -d. -f1 /proc/uptime");
$loadavg_array = explode(" ", exec("cat /proc/loadavg"));
$loadavg = $loadavg_array;
$days = floor($uptime/60/60/24);
$hours = $uptime/60/60%24;
$mins = $uptime/60%60;
$secs = $uptime%60;
echo "This server has been up $days day(s) $hours hour(s) $mins minute(s) and $secs second(s)";
print("[ Current server load: " . $loadavg . " ]");
Contributed addition by mikegull
To add to this block the current memory stats, in kb, for the server, use the following. This should work on most Linux servers, but not all.
$memstats = shell_exec("grep Mem /proc/meminfo");
print 'Server Memory:<BR />' . str_replace("\n", '<BR />', $memstats);