note 87091 added to function.memory-get-usage

From: Date: Wed, 19 Nov 2008 04:18:46 +0000
Subject: note 87091 added to function.memory-get-usage
Groups: php.notes 
Request: Send a blank email to php-notes+get-146689@lists.php.net to get a copy of this message
Decision a memory_get_usage problem for windows system Tested OS: Windows XP Server: Apache PHP must be loaded as CGI to get correctly memory usage by Process ID ( getmypid() ) and with cmd-tools like tasklist.exe PHP as CGI have your own PID instead constant Apache PID and you get a true memory size independed form Apache memory usage. Configure in httpd.conf of Apache: 1. Comment the line like this: LoadModule php4_module "/usr/local/php/sapi/php4apache.dll" or LoadModule php5_module "/usr/local/php5/php5apache.dll" 2. Add this and edit your path to php: <Directory "z:/usr/local/php"> Options ExecCGI </Directory> ScriptAlias "/__php_dir__/" "z:/usr/local/php/" Action application/x-httpd-php "/__php_dir__/php.exe" 3. Restart Apache Use this PHP-code: <?php /** * A memory_get_usage() for Windows System, wich compiled without --enable-memory-limit * PHP must be loaded as CGI * Greetings form miteigi nemoto * @return string */ function memory_get_usage_by_tasklist() { $output = array(); exec( 'tasklist ', $output ); foreach ($output as $value) { $ex=explode(" ",$value); $count_ex=count($ex); if (eregi(" ".getmypid()." Console",$value)) { $memory_size=$ex[$count_ex-2]." Kb"; return $memory_size; } } } echo memory_get_usage_by_tasklist(); ?> ---- Server IP: 195.54.192.44 Probable Submitter: 127.0.0.1 ---- Manual Page -- http://www.php.net/manual/en/function.memory-get-usage.php Edit -- https://master.php.net/note/edit/87091 Del: integrated -- https://master.php.net/note/delete/87091/integrated Del: useless -- https://master.php.net/note/delete/87091/useless Del: bad code -- https://master.php.net/note/delete/87091/bad+code Del: spam -- https://master.php.net/note/delete/87091/spam Del: non-english -- https://master.php.net/note/delete/87091/non-english Del: in docs -- https://master.php.net/note/delete/87091/in+docs Del: other reasons-- https://master.php.net/note/delete/87091 Reject -- https://master.php.net/note/reject/87091 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#146689) next »