0

I've written a basic indexing script for my site and it seems to be working...somewhat. It gets through about 3/4 of the pages it needs to index and then give this error:

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

It seems to hang up in a different spot each time, too. I ran it a minute later and got this:

Fatal error: Maximum execution time of 0 seconds exceeded in /Zend/Search/Lucene/Storage/Directory/Filesystem.php on line 349

Here's the script:

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);
}
Vecta
  • 2,312
  • 5
  • 28
  • 47
  • 2
    Does the error message really say 0 seconds exceeded? Usually `set_time_limit(0);` means no limit – Mike B Jun 01 '12 at 15:38
  • Yep, that is the error verbatim. I believe it is currently set to no time limit. – Vecta Jun 01 '12 at 15:42
  • On a sidenote : indexing is a lot faster when using the Java implementation. I'd personally recommend using Solr (refer to the [PHP Solr documentation](http://php.net/manual/en/book.solr.php) for more information). Setup might be a bit hard, but it's worth it. – wimvds Jun 01 '12 at 18:37

1 Answers1

5

Maybe your task is time consuming? Then increase time limit set_time_limit:

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

Try increasing max_execution_time

 ini_set('max_execution_time', 5000); 

There is also max_input_time

 ini_set('max_input_time', 5000); 

If it still does not work, you will need to track down parts what is executing forever

Aurimas Ličkus
  • 9,886
  • 4
  • 24
  • 26