if (!function_exis ts('memory_get_ usage')) {
/**
* Determine the amount of memory you are allowed to have
*
* @access public
* @return long
* @see actual_path
* @link http://us2.php.net/manual/en/functio...sage.php#64156
How to use memory_get_usag e() function in this
context
* @link
http://groups.google.com/group/comp....35b76328c2bab1
Upgrade to client status of memory_get_usag e() for use within Windows
XP Home
*/
function memory_get_usag e() {
print_r(extensi on_loaded('win3 2ps')); die('');
global $clientFolderPa th;
$outputArray = array();
if (($_SERVER['windir'] || $_ENV['windir']) &&
@extension_load ed('win32ps')) {
return win32_ps_stat_p roc(getmypid()) ;
} elseif (($_SERVER['windir'] || $_ENV['windir']) &&
@is_dir(actual_ path(realpath(" $clientFolderPa th/win"))) &&
@is_file(actual _path(realpath( "$clientFolderP ath/win/
pslist.exe")))
) {
exec('"' . actual_path($cl ientFolderPath) . '/win/pslist" -m ' .
getmypid(), $outputArray, $rc);
print_r($output Array);
return trim(substr($ou tputArray[8], 38, 10));
} elseif ($_SERVER['windir'] || $_ENV['windir']) {
exec('tasklist /FI "PID eq ' . getmypid() . '" /FO LIST',
$outputArray);
return preg_replace( '/[\D]/', '', $outputArray[5] ) * 1024;
} else {
exec('ps -o rss -p ' . getmypid(), $outputArray);
return $outputArray[1] * 1024;
}
}
}
[/PHP]
Environment: Win XP, Wamp5 (Apache 2.0.53, PHP 5.2.0)
As it stands, win32ps.dll is not loaded, thus,
extension_loade d('win32ps') should return false:
ArrayBut instead Apache locks up into an infinite loop, producing no Apache
(
[0] =bcmath
[1] =calendar
[2] =com_dotnet
[3] =ctype
[4] =session
[5] =filter
[6] =ftp
[7] =hash
[8] =iconv
[9] =json
[10] =odbc
[11] =pcre
[12] =Reflection
[13] =date
[14] =libxml
[15] =standard
[16] =tokenizer
[17] =zlib
[18] =SimpleXML
[19] =dom
[20] =SPL
[21] =wddx
[22] =xml
[23] =xmlreader
[24] =xmlwriter
[25] =apache2handler
[26] =mbstring
[27] =gd
[28] =mysql
[29] =mysqli
[30] =PDO
[31] =pdo_sqlite
[32] =SQLite
)
errors, no PHP errors, no output, nothing, just sits there trying to
load the phge without ever timing out or even producing 100% CPU
memory loss!
Have you ever seen this before with extension_loade d(), a bug or what
is really going on?
Thanx
Phil