News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Juozas Kaziukenas' Blog:
Prevent scripts from being killed
March 26, 2009 @ 13:18:26

Juozas Kaziukenas has a helpful tip you can use on those long-running scripts to keep going - the set_time_limit function.

I have some very time consuming scripts running through CRON - some nice web scrapping jobs. They are not processing-intense, but rather slow because of slow websites. All these jobs are really hard to divide in to separate scripts (another article), so one script should have no limits to run for hours. However, web servers don't like it by default.

He show how you can use the set_time_limit function to free your script of the timeout limitation (which can be a good and bad thing) or having your script output something, like a "processing" message, as it runs through the loop to keep the timeout away. You can also use the ignore_user_abort function to continue the process even if the user hits the stop button or otherwise closes the request.

0 comments voice your opinion now!
timeout user settimelimit ignoreuserabort processing


blog comments powered by Disqus

Similar Posts

Atlanta PHP Users Group: February Meeting Reminder (2nd @ 7pm)

Zend Developer Zone: PHP Security Tips #8 & #9

Pierre-Alain Joye's Blog: Prominent PHP Users (developers), do your homework or be humble/keep quiet

Zend Developer Zone: AJAX Chat Tutorial Part 6 : Updating the User List

Nexen.net: New PHP User Group formed in Angers


Community Events











Don't see your event here?
Let us know!


hack podcast hhvm code unittest language opinion release facebook package introduction component install application framework symfony2 example overview security composer

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework