WordPress致命错误:在1832行的wp-includes / wp-db.php中,已用尽的内存大小为536870912字节(试图分配77字节) [英] WordPress Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 77 bytes) in wp-includes/wp-db.php on line 1832
问题描述
我最近在WordPress网站上发现有时会收到500 Internal Server Error。我检查了日志,发现有很多行,例如:
I noticed recently on my WordPress website I'm getting sometimes 500 Internal Server Error. I checked logs and I have many lines like:
[Mon Oct 03 01:25:24.357439 2016] [fcgid:warn] [pid 12840] [客户端
83.27.211.107:36968] mod_fcgid:stderr:PHP致命错误:/ var / www / vhosts / mywebsite /中允许的内存大小为536870912字节已用尽(试图分配77字节)
1832
[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
上的public_html / wp-includes / wp-db.php我试图增加内存限制:
I tried to increase memory limit:
define('WP_MAX_MEMORY_LIMIT','512M');
define( 'WP_MAX_MEMORY_LIMIT' , '512M' );
define('WP_MEMORY_LIMIT ','512M');
define( 'WP_MEMORY_LIMIT' , '512M' );
甚至更多,但没有用。无论我设置什么,它仍然超出内存限制一些字节。我认为对数据库的某些查询存在问题,但是如何检查?
And even more, but it didn't work. No matter what I set it still exceeding memory limit by some bytes. I think there's a problem with some queries to a database, but how to check which?
includes / wp-db.php的内容:
Content of the 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引起的安全插件。我关闭了它,错误消失了。如果我知道此插件的哪个部分导致了超出内存限制,我将对此问题进行更多调查并编辑此答案。
The problem was caused by iThemes Security plugin. I turned off it and errors have gone. I'll investigate this problem more and edit this answer if I'll know what part of this plugin caused exceeding memory limit.
这篇关于WordPress致命错误:在1832行的wp-includes / wp-db.php中,已用尽的内存大小为536870912字节(试图分配77字节)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!