[wp-trac] [WordPress Trac] #11843: htaccess pointing to wordpress makes CPU overload
WordPress Trac
wp-trac at lists.automattic.com
Sat Jan 9 21:09:58 UTC 2010
#11843: htaccess pointing to wordpress makes CPU overload
-----------------------------+----------------------------------------------
Reporter: cisoprogressivo | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Unassigned
Component: General | Version: 2.9.1
Severity: normal | Keywords: htaccess, premalink
-----------------------------+----------------------------------------------
Comment(by Denis-de-Bernardy):
What the message means, is, if you have your host enable the apache
functions, WordPress will detect mod_rewrite using apache_mod_loaded()
instead of trying to find it using phpinfo() and an output buffer. The
latter method fails (as done on your server) when phpinfo() doesn't return
the apache modules. (Thanks for the feedback, too. It helps to know it
wasn't clear enough.)
I'm suspecting it's the issue, too. I'm assuming this is a live server, so
let's try a live diagnosis. In functions.php, there is a
apache_mod_loaded() function:
{{{
function apache_mod_loaded($mod, $default = false) {
global $is_apache;
if ( !$is_apache )
return false;
if ( function_exists('apache_get_modules') ) {
$mods = apache_get_modules();
if ( in_array($mod, $mods) )
return true;
} elseif ( function_exists('phpinfo') ) {
ob_start();
phpinfo(8);
$phpinfo = ob_get_clean();
if ( false !== strpos($phpinfo, $mod) )
return true;
}
return $default;
}
}}}
get_mod_rewrite() calls it with a default of true.
please change:
{{{
$phpinfo = ob_get_clean();
if ( false !== strpos($phpinfo, $mod) )
return true;
}}}
to:
{{{
$phpinfo = ob_get_clean();
$count = get_option('check_mod_rewrite_counts');
update_option('check_mod_rewrite_counts', ++$count);
if ( false !== strpos($phpinfo, $mod) )
return true;
}}}
then in wp-config.php, *after* WP is loaded, add:
{{{
if ( isset($_GET['test']) )
echo get_option('check_mod_rewrite_counts');
}}}
and then visit yoursite.com?test
It might be that your site is calling the mess on every page load for some
reason.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11843#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list