php - Drupal 7 错误导致 php 最大超时

标签 php mysql drupal drupal-7

正在尝试找出此错误。有时,用户编辑节点时会发生如下错误:

PHP Fatal error: Maximum execution time of 30 seconds exceeded in somefilestructure/includes/database/mysql/query.inc on line 53, referer: https://abc123.com/node/25806/edit/?destination=admin/content%253Fpage%253D1

这是第 53 行代码块:

 // If we're selecting from a SelectQuery, finish building the query and
// pass it back, as any remaining options are irrelevant.
if (!empty($this->fromQuery)) {
  $insert_fields_string = $insert_fields ? ' (' . implode(', ', $insert_fields) . ') ' : ' ';
  return $comments . 'INSERT INTO {' . $this->table . '}' . $insert_fields_string . $this->fromQuery;
}

用户只能添加内容、上传图像文件和编辑当前内容等。没什么疯狂的。

我不想增加最大超时来尝试解决该问题,我们需要找到导致错误的位置/方式并修复它。

如果有人对此问题有任何反馈,请告诉我。

谢谢!

最佳答案

通常在这些情况下,第 53 行 不会是罪魁祸首,它只是在执行时间耗尽时恰好执行的代码。

发生这种情况的原因可能有很多 - 当您保存节点时,模块可能会尝试做太多的事情,或者您有一些自定义的代码可能会再次尝试做太多的处理。我们在使用段落模块时遇到过这样的情况:添加到节点的段落越多,节点保存的速度就越慢,并且可能会超时。

除非您可以在日志中发现可能触发此问题的内容,或者可以想到您最近安装的任何可能导致此问题的模块,否则调试和修复非常困难。如果您遇到困难,我之前使用过的最好的性能调试工具是 Xhprof。在大多数情况下,罪魁祸首是什么就变得非常清楚了。 这是我过去安装 xhprof 的示例教程 - http://www.pixelite.co.nz/article/profiling-drupal-7-performance-xhprof-and-devel/

但是在开始设置 xhprof 之前,我建议您查看最近更改了哪些代码、安装了哪些模块,并且可能尝试一点一点地卸载模块,直到它停止超时。

关于php - Drupal 7 错误导致 php 最大超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35512578/

相关文章:

drupal - Drupal 中的内容迁移

php - 如何创建比简单的匹配和搜索更好的搜索算法

javascript - Js数组检测: number of values from php array found (grabbed from database)

php - Uncaught Error : Call to undefined function mysql_select_db()

MySQL 性能 - LEFT JOIN/HAVING 与子查询

javascript - 如何将 HTML/JS 导入到 Drupal 中?

apache - 如何从 URL 中删除 index.php

PHP 4 不会在 Apache 重启后对 PHP.ini 进行更改

php - PayPal IPN 返回 item_number 为空

PHP MySQL UPDATE导致错误