2012-06-01 2 views
0

내 사이트에 대한 기본 인덱싱 스크립트를 작성했으며 다소 효과가있는 것으로 보입니다. 색인을 생성하는 데 필요한 페이지의 약 3/4을 가져와이 오류를 표시합니다.Zend Lucene : 치명적인 오류, 최대 실행 시간

Fatal error: Maximum execution time of 0 seconds exceeded in /Zend/Search/Lucene/Analysis/Analyzer.php on line 166

매번 다른 위치에 끊어지는 것 같습니다. 잠깐 나중에 실행이있어 :

스크립트가

Fatal error: Maximum execution time of 0 seconds exceeded in /Zend/Search/Lucene/Storage/Directory/Filesystem.php on line 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); 
} 
+2

Do 오류 메시지가 실제로 0 초를 초과했다고 말하는가? 보통'set_time_limit (0);'은 아무런 제한이 없다는 것을 의미합니다. –

+0

예, 그게 바로 오류입니다. 나는 그것이 현재 시간 제한으로 설정되어 있다고 생각합니다. – Vecta

+0

부연 설명 : Java 구현을 사용할 때 색인 생성이 훨씬 빠릅니다. 개인적으로 Solr을 사용하는 것이 좋습니다 (자세한 내용은 [PHP Solr documentation] (http://php.net/manual/en/book.solr.php) 참조). 설치가 다소 어려울 수도 있지만 그만한 가치가 있습니다. – wimvds

답변

5

어쩌면 당신의 작업은 많은 시간이 소요된다? 그런 다음 시간 제한 set_time_limit 증가 : 그것은 여전히 ​​작동하지 않는 경우도 max_input_time

ini_set('max_input_time', 5000); 

있습니다 max_execution_time

ini_set('max_execution_time', 5000); 

당신이 부품을 추적 할 필요가 증가

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

는 시도를 무엇 영원히 실행 중입니다

+0

set_time_limit이 트릭을했습니다. 고마워요! – Vecta