How to Display Server Load in PHP
Posted on November 15th, 2007 by Jans
When developing a PHP application or monitoring a web server, it’s important to know what your server load is to properly identify that there is a problem.
For those interested, there is a very easy way to output your load in PHP using the exec function.
See the code below.
$load = exec(”uptime”);
$load = split(”load average:”, $load);
$load = split(”, “, $load[1]);
$load = $load[0];
echo “Current Load: $load”;
Place that snippet wherever you want in your PHP application to output the current server load.
Of course, since “uptime” is a Unix command this won’t work on Windows servers, and from what I understand, there’s no easy solution for those users.
Filed under: PHP

That was useful.
Thx
Great blog too.