maddogandnoriko Posted March 6, 2009 Share Posted March 6, 2009 I have a fairly long script that is checking links. For the time being I am calling it in my browser and running it on my local server and echoing stuff back to see what is going on. When it is running and I click the stop button does the script stop executing also or does it continue to the end? On the same note if it does still run what happens if the script gets called again? Thank you very much, Todd Quote Link to comment Share on other sites More sharing options...
jjacquay712 Posted March 6, 2009 Share Posted March 6, 2009 PHP scripts run until they complete, even if you close your browser. However you can set the timeout of a script to stop executing, in which case you script would run until it hits the time limit you specified. Here is the function: set_time_limit ( int $seconds ) http://us3.php.net/set_time_limit Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted March 6, 2009 Share Posted March 6, 2009 You can also change PHP's behaviour when the browser stop button is clicked by changing the value of ignore_user_abort() Quote Link to comment Share on other sites More sharing options...
maddogandnoriko Posted March 6, 2009 Author Share Posted March 6, 2009 excellent! That is what I wanted to know. What happens if I stop it in the browser and reload the "page" does another copy of the script run or does it wait until the first one is done? Todd Quote Link to comment Share on other sites More sharing options...
jjacquay712 Posted March 6, 2009 Share Posted March 6, 2009 The script would run even if another script is already being executed. Quote Link to comment Share on other sites More sharing options...
npsari Posted March 6, 2009 Share Posted March 6, 2009 Actually, if i do this funtion... <? while (keep_the_echo){ print"Hello"; } ?> It keeps printing Hello But when i click stop, it stops Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted March 6, 2009 Share Posted March 6, 2009 But when i click stop, it stops How do you know that it stops? Or if it just isn't sending anything back to the browser any more? The program on the server could still be running! Quote Link to comment Share on other sites More sharing options...
npsari Posted March 6, 2009 Share Posted March 6, 2009 Really, so, is it still printing now while we speak? What if i close the page completely Quote Link to comment Share on other sites More sharing options...
maddogandnoriko Posted March 6, 2009 Author Share Posted March 6, 2009 The only way I knew mine was still running was I had an error and my error log kept popping up. Thank you for your answers Todd Quote Link to comment Share on other sites More sharing options...
maddogandnoriko Posted March 6, 2009 Author Share Posted March 6, 2009 Is there a way to know if it is still running? More importantly is here a way to not have 100 running at a time? The pages vary in density with links, some may have none a large one has thousands. I am not worried if one or two overlap but I probably don't want a bunch running at the same time. Any suggestions? Todd Quote Link to comment 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.