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 Link to comment https://forums.phpfreaks.com/topic/148165-script-run-when-browser-stopped/ 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 Link to comment https://forums.phpfreaks.com/topic/148165-script-run-when-browser-stopped/#findComment-777771 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() Link to comment https://forums.phpfreaks.com/topic/148165-script-run-when-browser-stopped/#findComment-777775 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 Link to comment https://forums.phpfreaks.com/topic/148165-script-run-when-browser-stopped/#findComment-777781 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. Link to comment https://forums.phpfreaks.com/topic/148165-script-run-when-browser-stopped/#findComment-777787 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 Link to comment https://forums.phpfreaks.com/topic/148165-script-run-when-browser-stopped/#findComment-777793 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! Link to comment https://forums.phpfreaks.com/topic/148165-script-run-when-browser-stopped/#findComment-777799 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 Link to comment https://forums.phpfreaks.com/topic/148165-script-run-when-browser-stopped/#findComment-777807 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 Link to comment https://forums.phpfreaks.com/topic/148165-script-run-when-browser-stopped/#findComment-777814 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 Link to comment https://forums.phpfreaks.com/topic/148165-script-run-when-browser-stopped/#findComment-777822 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.