View Full Version : Avoid PHP script timeout
08-24-2011, 02:08 PM
I have a script that will basically be a web crawler and I want it to run for a long time obviously to do the crawling. What are best approaches so the script doesn't timeout? If I'm running this on my local machine can I do it as a cron job? Thank you for your suggestions.
08-24-2011, 03:47 PM
Yes you can run any php script via a scheduling system but you'll need to look up the various parameters / switches that need to be passed via the command line. Alternatively you could use a service like setcronjob to make a http call to your script - using ignore_user_abort(true) to ensure the script continues executing after the http client disconnects.
08-24-2011, 04:00 PM
Thanks, if I'm using the XAMPP locally on my computer, does it have anything in it to run the cronjob or would I just have to set the set_time_limit(0); in my php.ini file and execute the script?
08-24-2011, 06:34 PM
Scriptwise just set_time_limit() but as i've said previously you need to checkout the command line options yourself. I don't know what cron system xampp uses as I don't use xampp (compared to uniformserver it takes up far too much diskspace).
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.