if you mean how much ramcpu php is using then you can do the following using plain php without using any package: this returns the
if you mean how much ram/cpu php is using then you can do the following using plain php without using any package: this returns the ram usage:
function get_server_memory_usage(){
$free = shell_exec('free');
$free = (string)trim($free);
$free_arr = explode("\n", $free);
$mem = explode(" ", $free_arr[1]);
$mem = array_filter($mem);
$mem = array_merge($mem);
$memory_usage = $mem[2]/$mem[1]*100;
return $memory_usage;
}
cpu usage:
function get_server_cpu_usage(){
$load = sys_getloadavg();
return $load[0];
}
Native Conditions:
$load = sys_getloadavg();
$limit =15; //percent cpu
if ($load[0] >= $limit) {
die("Oops Server Busy, this message was automate from Dimas Lanjaka For telling users, there too many processed.");
}