elad135 Posted September 13, 2011 Share Posted September 13, 2011 I really hit a wall while trying to figure out how to stop my script from terminating early. First, my website is located on an IIS server. Second, the script I'm referring to is supposed to be some kind of a 'thread' (and I know this is not the place to use PHP but it's not my website and it's not my script - I only need to get it to work). So it basically opens in the background and stays alive by using the Sleep function inside a For loop (until some term has been met). My problem is that the script is being terminated after about 3-5 minutes (not sure exactly after how long). I already tried adding the set_time_limit(0) and it had no effect. Does anyone have an idea how can I solve this problem and why the set_time_limit(0) is not working? P.S. The server is not in Safe Mode. Quote Link to comment https://forums.phpfreaks.com/topic/247044-early-script-termination/ Share on other sites More sharing options...
AyKay47 Posted September 13, 2011 Share Posted September 13, 2011 can you post the code where the script is being set to run in the background using the sleep() function Quote Link to comment https://forums.phpfreaks.com/topic/247044-early-script-termination/#findComment-1268736 Share on other sites More sharing options...
xyph Posted September 13, 2011 Share Posted September 13, 2011 Possibly error'ing out? Try running the script in console, or write errors to a file to debug. Quote Link to comment https://forums.phpfreaks.com/topic/247044-early-script-termination/#findComment-1268739 Share on other sites More sharing options...
elad135 Posted September 13, 2011 Author Share Posted September 13, 2011 I prefer not to post the code here because this isn't my code and I'm not sure that the person who owns the code would want me to post it. Regarding the possibility of it error'ing out. The code seems to work just fine on my own local server. The server that is giving me the problem is my university's server. It also means that I don't have access to the console. Just in case it does error out for some reason, specifically on this server, what method can I use to print out all the errors that script sends out (including MySQL errors)? Quote Link to comment https://forums.phpfreaks.com/topic/247044-early-script-termination/#findComment-1268746 Share on other sites More sharing options...
xyph Posted September 13, 2011 Share Posted September 13, 2011 Do you have access to php.ini? If so, modify error_log = /var/log/php-scripts.log. Otherwise, write a custom error handler that outputs to a file, and use set_error_handler() in your script. Quote Link to comment https://forums.phpfreaks.com/topic/247044-early-script-termination/#findComment-1268867 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.