Jump to content

How to measure available RAM


martico

Recommended Posts

Can anyone tell me if there is an PHP function to return the amount of available RAM. We have what looks like a memory leak issue on an XP system running Apache and it would be nice to be able to monitor the available RAM remotely.

Thanks.
Link to comment
Share on other sites

I don't know of anything in PHP that can do this, but it might be possible. You may have to set something up on the server that will get the info for you and put it in a text file and then PHP can read the text file and display the results.
Link to comment
Share on other sites

Just tested this on my WinXP Pro box and works ok - Bare in mind I have a processor with hyperthreading enabled so the output index might be different for the available memory compared to the machine you may run it on - If it is incorrect, run print_r($output) to get the correct index.
[code]<?php
exec("systeminfo",$output)
echo $output[26];
?>[/code]
Hope this helps.

NOTE: I have left the semi-colon off of the end of the exec() line as it appears I can't post with it there - Looks like a forum bug...
Link to comment
Share on other sites

[!--quoteo(post=368105:date=Apr 24 2006, 08:28 PM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Apr 24 2006, 08:28 PM) [snapback]368105[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Just tested this on my WinXP Pro box and works ok - Bare in mind I have a processor with hyperthreading enabled so the output index might be different for the available memory compared to the machine you may run it on - If it is incorrect, run print_r($output) to get the correct index.
[code]<?php
exec("systeminfo",$output)
echo $output[26];
?>[/code]
Hope this helps.

NOTE: I have left the semi-colon off of the end of the exec() line as it appears I can't post with it there - Looks like a forum bug...
[/quote]

Many thanks to both of you for replying - the "systeminfo" seems a great way to go.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.