Memory usage (PHP)

Discussion in 'Programming/Scripts' started by homo, Feb 22, 2009.

  1. homo

    homo New Member

    Iam searching for a script able to calculate the per sent (%) amount of ram used by the server, for example: used 512mb of 1024mb 50%.
     
  2. homo

    homo New Member

    I have made this scrip:

    <?php
    $mem = exec("cat /proc/meminfo");
    $mem = split(" ",$mem);
    echo $mem[1];
    ?>

    but the output is blank.
    I want to find the exact amount of the used memory, by making the string to integer
     
  3. falko

    falko Super Moderator ISPConfig Developer

    Probably a permissions problem. I don't know if the webserver user is allowed to run cat /proc/meminfo.
     
    Last edited: Mar 11, 2009
  4. id10t

    id10t Member

    You could probably do something to work around the output of free (or maybe free -l ) and/or top, just call it from within php and then process its output
     
  5. hardy123

    hardy123 New Member

    I havn't come across that type of problem so far.I think it will be great if i am able to solve it.
     

Share This Page