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.
Asked
Active
Viewed 57 times
1 Answers
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