Re: Determining system resources
| From: | Francisco M. Marzoa Alonso | Date: | Thu, 04 Nov 2004 18:31:24 +0000 |
| Subject: | Re: Determining system resources | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-201199@lists.php.net to get a copy of this message | ||
Greetings Robin,
As far as you cannot lock another processes in the system, so this will not give you the security that the resources will not change -and probably they'll do it- while you're trying to download that file.
Best regards,
Robin Getz wrote:
I have been unable to find a php function to determine available system
memory (physical and swap)?
Right now I am using something like:
=========
# ensure there is enough free memory for the download
$free = shell_exec('free -b'); $i=0; while ( $i != strlen($free) ) {
i = strlen($free);
free = str_replace(' ',' ',$free); }
$free = str_replace("\n",'',$free);
$freeArray = explode(' ',$free);
$total_free = $freeArray[9] + $freeArray[18];
==========
Does anyone have any ideas that could be used on all OSes? i.e. Without shell_exec()?
Thanks in advance.
-Robin