By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,890 Members | 1,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,890 IT Pros & Developers. It's quick & easy.

extension_loaded() causes Apache to lock up tight!

P: n/a
[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/functio...sage.php#64156
How to use memory_get_usage() function in this

context
* @link

http://groups.google.com/group/comp....35b76328c2bab1

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:

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
)
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

Feb 18 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.