Get total available system memory with PHP on Windows
Using PHP, I'd like to get the total memory available to the system (not just the free or used memory). On Linux it's quite straight forward. You can do: $memory = fopen('/proc/meminfo'); and then parse the file. Is anyone aware of an equivalent method for Windows? I'm open to any suggestions. Edit: We have a solution (but StackOverflow won't let me answer my own question): exec( 'systeminfo', $output ); foreach ( $output as $value ) { if ( preg_match( '|Total Physical Memory\:([^$]+)|', $value, $m ) ) { $memory = trim( $m[1] ); } Not the most elegant solution, and it's very slow, but it suits