php - WordPress fatal error : Allowed memory size of 536870912 bytes exhausted (tried to allocate 77 bytes) in wp-includes/wp-db. php 第 1832 行

标签 php wordpress crash internal-server-error

我最近注意到我的 WordPress 网站有时会收到 500 内部服务器错误。我检查了日志,有很多行,例如:

[Mon Oct 03 01:25:24.357439 2016] [fcgid:warn] [pid 12840] [client 83.27.211.107:36968] mod_fcgid: stderr: PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 77 bytes) in /var/www/vhosts/mywebsite/public_html/wp-includes/wp-db.php on line 1832

我尝试增加内存限制:

define( 'WP_MAX_MEMORY_LIMIT' , '512M' );

define( 'WP_MEMORY_LIMIT' , '512M' );

甚至还有更多,但没有用。无论我设置什么,它仍然超出内存限制一些字节。我认为对数据库的某些查询存在问题,但如何检查哪些查询?

includes/wp-db.php 的内容:

} else {
    $num_rows = 0;
    if ( $this->use_mysqli && $this->result instanceof mysqli_result ) {
        while ( $row = mysqli_fetch_object( $this->result ) ) {
            $this->last_result[$num_rows] = $row;
            $num_rows++;
        }
    } elseif ( is_resource( $this->result ) ) {
        // server crashing at line below
        while ( $row = mysql_fetch_object( $this->result ) ) {
            $this->last_result[$num_rows] = $row;
            $num_rows++;
        }
    }

    // Log number of rows the query returned
    // and return number of rows selected
    $this->num_rows = $num_rows;
    $return_val     = $num_rows;
}

最佳答案

该问题是由 iThemes Security 插件引起的。我把它关掉了,错误就消失了。如果我知道这个插件的哪个部分导致超出内存限制,我将进一步调查这个问题并编辑这个答案。

关于php - WordPress fatal error : Allowed memory size of 536870912 bytes exhausted (tried to allocate 77 bytes) in wp-includes/wp-db. php 第 1832 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39840555/

相关文章:

php - PHP 和 MySQL 中的三级巨型菜单

php - 这样更新sql怎么办?

wordpress - 解码失败: Syntax error Magento

php - Wordpress 自定义联系表不起作用

java - 在 JOGL 应用程序中使用纹理时,ati 显卡最终都会崩溃

php - 从 URL 中删除特定参数,同时保留其他参数

php - 如何从数组中获取列名并导出到excel

php - Paypal 。支付信息页面

jar - LWJGL 可执行 jar 启动然后崩溃

python - 为什么打开该文件时Python tkinter崩溃?