【问题标题】:Zend Lucene: Fatal Error, Maximum Execution TimeZend Lucene:致命错误,最长执行时间
【发布时间】:2012-06-06 20:50:30
【问题描述】:

我已经为我的网站编写了一个基本的索引脚本,它似乎正在工作......有点。它通过了大约 3/4 需要索引的页面,然后给出了这个错误:

致命错误:超过 0 秒的最大执行时间 /Zend/Search/Lucene/Analysis/Analyzer.php 第 166 行

似乎每次都挂在不同的位置。一分钟后我运行它并得到了这个:

致命错误:超过 0 秒的最大执行时间 /Zend/Search/Lucene/Storage/Directory/Filesystem.php 在第 349 行

这是脚本:

foreach($all_items as $item) {
    $doc = new Zend_Search_Lucene_Document();

    $doc->addField(Zend_Search_Lucene_Field::Text('title', $item['pagetitle']));

    $doc->addField(Zend_Search_Lucene_Field::Text('url', $item['url']));

    $doc->addField(Zend_Search_Lucene_Field::Text('country', $item['country']));

    // Add document to the index
    $index->addDocument($doc);
}

【问题讨论】:

  • 错误信息真的说超过0秒吗?通常set_time_limit(0);表示没有限制
  • 是的,这是逐字记录的错误。我相信它目前没有时间限制。
  • 附带说明:使用 Java 实现时,索引速度要快得多。我个人建议使用 Solr(有关更多信息,请参阅 PHP Solr documentation)。设置可能有点困难,但值得。

标签: php zend-framework lucene


【解决方案1】:

也许您的任务很耗时? 然后增加时间限制set_time_limit

 set_time_limit(0); //no time limit
 set_time_limit(500) //500 sec limit

尝试增加max_execution_time

 ini_set('max_execution_time', 5000); 

还有max_input_time

 ini_set('max_input_time', 5000); 

如果它仍然不起作用,您将需要跟踪永久执行的部分

【讨论】:

    猜你喜欢
    • 2023-04-01
    • 2023-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-09
    • 2013-09-03
    • 2014-04-20
    • 2011-12-02
    相关资源
    最近更新 更多