toastyc12 Posted October 15, 2010 Share Posted October 15, 2010 I'm trying to run 5 php scripts that all run about ~200 MySQL commands each. The basic framwork is: 1.) Fetch a list of names from a table 2.) Names are put in an array, Loop starts 3.) For each name that is retrieved, it is matched with a name on a website (Echo for each name retrieved for logging purposes) 4.) the information retrieved from the website is stored in the table (using UPDATE) 5.) repeated for each name, until the end of the list is reached. And it works, but seldom. When I run these in a web browser, some of the scripts that fetch a larger list of names from the table times out, whereas the shorter lists will succeed in a full update. I've also tried setting these up as a Cron job (I'm using Hosting24 as my host), but the output is no better. The log shows that it runs about 8-9 names before stopping. No error, no nothing. Just end of log. I've tried using set_time_limit(); and have set it to 0 for unlimited, and even tried setting it really high (anywhere between 100 and 900 seconds), but to no avail. Is there anything else I can do? Quote Link to comment https://forums.phpfreaks.com/topic/215969-script-timing-out/ Share on other sites More sharing options...
the182guy Posted October 15, 2010 Share Posted October 15, 2010 You should avoid using echo over and over in scripts that take a long time to execute. The browser may be just giving up and closing the connection to the server. Try writing to a log file intead of echo's for debugging. Quote Link to comment https://forums.phpfreaks.com/topic/215969-script-timing-out/#findComment-1122581 Share on other sites More sharing options...
toastyc12 Posted October 15, 2010 Author Share Posted October 15, 2010 Alright, I commented out all of the echo lines, but now I'm not getting an output from the Cron jobs at all, however they still work when manually run in my browser. You put me a step closer with your suggestion, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/215969-script-timing-out/#findComment-1122585 Share on other sites More sharing options...
phpfreak Posted October 16, 2010 Share Posted October 16, 2010 You can check your php.ini file and make sure the timeout isn't too low there. Perhaps you don't have access to setting the set_time_limit() function. I recommend you pull a <? phpinfo() ?> and see what the timelimit settings are. You may also be having an Apache timeout as well, so you'll want to check out your apache config settings. Quote Link to comment https://forums.phpfreaks.com/topic/215969-script-timing-out/#findComment-1122629 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.