PHP Find out the RAM Baby

There is a web server with Linux. How to issue on the page how much free RAM has left. Moreover, the real RAM, not including any virtual.


Answer 1, Authority 100%

Maybe the function will help you
Memory_Get_USage


Answer 2

As it was previously

https://stackoverflow.com/questions/1455379/get-server-ram-with -PHP

Code – Copy and Works

 $fh = fopen('/proc/meminfo','r');
  $mem = 0;
  while ($line = fgets($fh)) {
    $pieces = array();
    if (preg_match('/^MemFree:\s+(\d+)\skB$/', $line, $pieces)) {
      $mem = $pieces[1];
      break;
    }
  }
  fclose($fh);
  echo "$mem kB RAM ";

So, in the link above – there are examples of other parsers!


Answer 3

Run / usr / bin / free and burst))