1

I am trying to write a basic web scraper in php. I am having an issue where if the server times out due to the parser taking too long then it deletes the content in my db. Is there a way to specify I want to run my parsing block for, say, 5 minutes? I have tried the set_time_limit(n) function before starting the loop, but setting set_time_limit(1) the script keeps running.

Sai Peri
  • 339
  • 1
  • 3
  • 17
  • I think you should check this thread: https://stackoverflow.com/questions/16171132/how-to-increase-maximum-execution-time-in-php – bpesch Mar 21 '20 at 20:31

1 Answers1

0

If PHP is running in safe mode, the only way is in the php.ini file. Or turn off safe mode and change the limit as follows:

void set_time_limit ( int $seconds )

or

set_time_limit(300); // 300seconds are 5 minutes

I hope this helps you

SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34