Reply to extension_loaded() causes Apache to lock up tight!

Your name:

Reply:


Posted by comp.lang.php on 02/18/07 20:10

[PHP]
if (!function_exists('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/function.memory-get-usage.php#64156
How to use memory_get_usage() function in this

context
* @link

http://groups.google.com/group/comp.lang.php/browse_frm/thread/475095e024649b24/7335b76328c2bab1?lnk=arm#7335b76328c2bab1

Upgrade to client status of memory_get_usage() for use within Windows
XP Home
*/
function memory_get_usage() {
print_r(extension_loaded('win32ps')); die('');
global $clientFolderPath;
$outputArray = array();
if (($_SERVER['windir'] || $_ENV['windir']) &&
@extension_loaded('win32ps')) {
return win32_ps_stat_proc(getmypid());
} elseif (($_SERVER['windir'] || $_ENV['windir']) &&
@is_dir(actual_path(realpath("$clientFolderPath/win"))) &&
@is_file(actual_path(realpath("$clientFolderPath/win/
pslist.exe")))
) {
exec('"' . actual_path($clientFolderPath) . '/win/pslist" -m ' .
getmypid(), $outputArray, $rc);
print_r($outputArray);
return trim(substr($outputArray[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_loaded('win32ps') should return false:

[quote]
Array
(
[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
)

[/quote]

But instead Apache locks up into an infinite loop, producing no Apache
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_loaded(), a bug or what
is really going on?

Thanx
Phil

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация