function GetInfoMemory()
{
exec('free -mo', $MemoryInf);
preg_match_all('/s+([0-9]+)/', $MemoryInf[1], $matches);
list($total, $used, $free, $shared, $buffers, $cached) = $matches[1];
// echo "Memory: " . $used . "/" . $total;
$MemoryInfo=array($free,$total, $used );
return $MemoryInfo;
}
exec - if this is your own server or your host allows running this function.
Also note that PHP has built-in functions, but they only let you find out how much memory has been used or allocated for running the PHP script itself, i.e. not the total memory
memory_get_usage Returns the amount of memory, in bytes, that has been allocated to the PHP script so far.
memory_get_peak_usage() - Returns the peak amount of memory allocated to PHP
memory_limit the maximum amount of memory available for running PHP scripts
Comments