本地主机上的ApacheCPU超过70%

时间:2014-04-19 作者:Amit Rahav

我在w8上的本地主机WAMP上运行了许多WP站点。我开始在一个新网站上工作,使用Sass和Zurb Foundation使用以下模板:http://jointswp.com/.

问题是:在我的工作中,每当我从索引页面进行查询时,apache服务器占用了我cpu的70%,页面无法加载。它只发生在这个网站上,只发生在这个specipic页面上。

这是索引中的代码。php:

<?php get_header(); ?>
    <div id="content">
        <div id="inner-content" class="row clearfix">
        <?php $caruselq = new WP_Query( array( \'post_type\' => \'action\') );?>
            <?php if ( $caruselq->have_posts() ) : while ( $caruselq->have_posts() ) :?>
                <?php include get_stylesheet_directory().\'/tryout.php\';//carusel?>
            <?php endwhile; ?>
        <?php else: ?>

        <?php endif;?>
        <div id="main" class="large-8 medium-8 columns clearfix" role="main">
                    <?php get_sidebar(); ?>
                </div> <!-- end #inner-content -->
            </div> <!-- end #content -->
<?php get_footer(); ?>
还有试用的代码。php:

<?php if (have_posts()) :?>
  <ul class="example-orbit" data-orbit data-options="slide_number:false;">
  <?php while (have_posts()) : the_post(); ?>
    <li>
      <?php the_post_thumbnail(); ?>
    <div class="orbit-caption">
      <?php the_excerpt();?>
    </div>
    </li>
      <?php endwhile;?>
  </ul>
<?php endif;?>
以下是apache在出现问题期间的日志:

1 - - [19/Apr/2014:18:05:38 +0300] "GET /favicon.ico HTTP/1.1" 404 209
::1 - - [19/Apr/2014:18:05:40 +0300] "GET /egood/wp-admin/plugins.php HTTP/1.1" 200 43845
::1 - - [19/Apr/2014:18:05:44 +0300] "GET /egood/wp-admin/load-scripts.php?c=1&load%5B%5D=hoverIntent,common,admin-bar,thickbox,plugin-install,svg-painter,heartbeat,wp-auth-check,underscore,shortcode,media-upload&ver=3.9 HTTP/1.1" 200 21434
::1 - - [19/Apr/2014:18:05:49 +0300] "GET /egood/wp-admin/plugins.php?action=delete-selected&checked%5B0%5D=akismet%2Fakismet.php&plugin_status=all&paged=1&s&_wpnonce=8adc278390 HTTP/1.1" 200 29629
::1 - - [19/Apr/2014:18:05:51 +0300] "GET /egood/wp-admin/load-scripts.php?c=1&load%5B%5D=hoverIntent,common,admin-bar,svg-painter,heartbeat,wp-auth-check,thickbox,underscore,shortcode,media-upload&ver=3.9 HTTP/1.1" 200 21188
::1 - - [19/Apr/2014:18:05:53 +0300] "POST /egood/wp-admin/plugins.php?action=delete-selected&checked%5B0%5D=akismet%2Fakismet.php&plugin_status=all&paged=1&s&_wpnonce=8adc278390 HTTP/1.1" 302 -
::1 - - [19/Apr/2014:18:05:53 +0300] "GET /egood/wp-admin/plugins.php?deleted=true&plugin_status=all&paged=1&s= HTTP/1.1" 200 42329
::1 - - [19/Apr/2014:18:05:54 +0300] "GET /egood/wp-content/plugins/kk-star-ratings/bhittani-framework/admin/js/colorpicker/js/colorpicker.js HTTP/1.1" 304 -
::1 - - [19/Apr/2014:18:05:54 +0300] "GET /egood/wp-content/plugins/kk-star-ratings/bhittani-framework/admin/js/lightbox.js HTTP/1.1" 304 -
::1 - - [19/Apr/2014:18:05:54 +0300] "GET /egood/wp-content/plugins/kk-star-ratings/bhittani-framework/admin/js/admin.js HTTP/1.1" 304 -
::1 - - [19/Apr/2014:18:05:54 +0300] "GET /egood/wp-content/plugins/kk-star-ratings/bhittani-framework/admin/js/script.js HTTP/1.1" 304 -
::1 - - [19/Apr/2014:18:05:54 +0300] "GET /egood/wp-admin/load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,utils&ver=3.9 HTTP/1.1" 200 40221
::1 - - [19/Apr/2014:18:05:54 +0300] "GET /egood/wp-admin/load-scripts.php?c=1&load%5B%5D=hoverIntent,common,admin-bar,thickbox,plugin-install,svg-painter,heartbeat,wp-auth-check,underscore,shortcode,media-upload&ver=3.9 HTTP/1.1" 200 21434
::1 - - [19/Apr/2014:18:06:55 +0300] "POST /egood/wp-admin/admin-ajax.php HTTP/1.1" 200 47
::1 - - [19/Apr/2014:18:07:27 +0300] "GET /egood/wp-admin/plugins.php?action=deactivate&plugin=jetpack%2Fjetpack.php&plugin_status=all&paged=1&s&_wpnonce=0cc932eb63 HTTP/1.1" 302 -
::1 - - [19/Apr/2014:18:07:28 +0300] "GET /egood/wp-admin/plugins.php?deactivate=true&plugin_status=all&paged=1&s= HTTP/1.1" 200 41519
::1 - - [19/Apr/2014:18:07:46 +0300] "GET /egood/wp-admin/plugins.php?action=deactivate&plugin=kk-star-ratings%2Findex.php&plugin_status=all&paged=1&s&_wpnonce=5d232328de HTTP/1.1" 302 -
::1 - - [19/Apr/2014:18:07:47 +0300] "GET /egood/wp-admin/plugins.php?deactivate=true&plugin_status=all&paged=1&s= HTTP/1.1" 200 38436
::1 - - [19/Apr/2014:18:07:47 +0300] "GET /egood/wp-admin/load-scripts.php?c=1&load%5B%5D=hoverIntent,common,admin-bar,thickbox,plugin-install,svg-painter,heartbeat,wp-auth-check&ver=3.9 HTTP/1.1" 200 14928
::1 - - [19/Apr/2014:18:08:48 +0300] "POST /egood/wp-admin/admin-ajax.php HTTP/1.1" 200 47
::1 - - [19/Apr/2014:18:09:48 +0300] "POST /egood/wp-admin/admin-ajax.php HTTP/1.1" 200 47
我一直试图通过更改WP\\u DEBUG和WP\\u DEBUG\\u日志从WP生成日志文件,但它不生成。。。

以下是今天的MYSQL日志文件:

2014-04-19 16:43:50 7000 [Note] Plugin \'FEDERATED\' is disabled.
2014-04-19 16:43:50 7000 [Note] InnoDB: The InnoDB memory heap is disabled
2014-04-19 16:43:50 7000 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2014-04-19 16:43:50 7000 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-04-19 16:43:50 7000 [Note] InnoDB: Not using CPU crc32 instructions
2014-04-19 16:43:50 7000 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-04-19 16:43:50 7000 [Note] InnoDB: Completed initialization of buffer pool
2014-04-19 16:43:50 7000 [Note] InnoDB: Highest supported file format is Barracuda.
2014-04-19 16:43:50 7000 [Note] InnoDB: 128 rollback segment(s) are active.
2014-04-19 16:43:50 7000 [Note] InnoDB: Waiting for purge to start
2014-04-19 16:43:50 7000 [Note] InnoDB: 5.6.12 started; log sequence number 105484389
2014-04-19 16:43:50 7000 [Note] Server hostname (bind-address): \'*\'; port: 3306
2014-04-19 16:43:50 7000 [Note] IPv6 is available.
2014-04-19 16:43:50 7000 [Note]   - \'::\' resolves to \'::\';
2014-04-19 16:43:50 7000 [Note] Server socket created on IP: \'::\'.
2014-04-19 16:43:51 7000 [Note] Event Scheduler: Loaded 0 events
2014-04-19 16:43:51 7000 [Note] wampmysqld: ready for connections.
Version: \'5.6.12-log\'  socket: \'\'  port: 3306  MySQL Community Server (GPL)

1 个回复
SO网友:Otto

你的试用期。php中有一个posts循环,您正在另一个循环中调用该文件。回路平方。我想你的内容实际上不是这样构造的?

结束

相关推荐

如果page_id匹配,则包括php文件

我认为这是一个简单的问题:我正在构建一个插件,到目前为止,如果我想包含一个php文件,我必须知道page\\u id-我会在page中输入以下命令。php(或我使用的任何页面模板):if (is_page(4552)) { include WP_PLUGIN_DIR .\'/file_to_include.php\'; } 现在,我有了一个钩子,可以在激活时创建一个post,并使用update\\u选项保存post\\u id。所以,这就是我知道$page\\u id是