oceans Posted January 7, 2009 Share Posted January 7, 2009 I am sending email sets, say to about 10 persons on the same page, one after the other, and database processing is involved for each email. (Thus the processing time is long) I encountered my page "dies (intermittently)" before completion of all 10 emails, probably due to preset life time for a page. (By the server) Can any one advice how I can set the following @ (.htacess): (1) When the page starts to work on a push of the submit button, it HAS to complete even if the user closes the page half way. (2) Lengthen the lifetime for a page at the server. Please advice if this 2 forced steps will hurt any functionally. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/ Share on other sites More sharing options...
genericnumber1 Posted January 7, 2009 Share Posted January 7, 2009 1: function: http://us2.php.net/ignore_user_abort or ini directive: (mentioned in) http://php.net/manual/en/features.connection-handling.php 2: function: http://us3.php.net/set_time_limit or ini directive: http://us3.php.net/manual/en/info.configuration.php#ini.max-execution-time Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/#findComment-731449 Share on other sites More sharing options...
l_kris06 Posted January 7, 2009 Share Posted January 7, 2009 Question 1: When a user hits on the submit button, the entire form will be posted to the server regardless of the browser being closed or left open. whatever has been sent to the server side will be processed. So lets say the user pushed the submit button, and closed his browser, he just wont be seeing the success or failure or other communique in return, thats all. Question 2: By default, php script timeout is 30 secs, so if your process of a)fetching the email address. b)patching your message. c)sending doesnt fall under the 30sec mark, your script will timeout. This is a simple thing to fix, you can increase the script timeout by using set set_time_limit(x); where x = number of seconds. I usually set x to 0. which means the page will never have a time limit to complete its execution. Rgds, Kris Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/#findComment-731450 Share on other sites More sharing options...
oceans Posted January 7, 2009 Author Share Posted January 7, 2009 Thanks mates, I found the following when I did info. ignore_user_abort Off max_execution_time 60 60 are they relevent to my problem, if so please do me a statement so that I will insert it in my .htacess file. I fear I may mass my .htacess file after which I have to ask for help from my provider Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/#findComment-731474 Share on other sites More sharing options...
oceans Posted January 8, 2009 Author Share Posted January 8, 2009 Can any one add... Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/#findComment-732157 Share on other sites More sharing options...
oceans Posted January 9, 2009 Author Share Posted January 9, 2009 Can any one add please Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/#findComment-733146 Share on other sites More sharing options...
genericnumber1 Posted January 9, 2009 Share Posted January 9, 2009 Did you read my links? On the mailer application add these lines: <?php ignore_user_abort(); set_time_limit(0); // This will go forever, even if the script somehow gets in a permanent loop eating up resources, consider just setting it to a very large number ?> edit: spelling Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/#findComment-733158 Share on other sites More sharing options...
DarkSuperHero Posted January 9, 2009 Share Posted January 9, 2009 why do you assume its not sending all 10 e-mail messages ? can you post some of your code ? genericnumber1 has a good solution for debugging...did you attempt it ? Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/#findComment-733292 Share on other sites More sharing options...
oceans Posted January 12, 2009 Author Share Posted January 12, 2009 Thanks, Yes it works, but I thought of putting it along in my .htaccess file among other things. I did once put the same instruction in .htaccess file. I forgot the syntex. <?php ignore_user_abort(); set_time_limit(0); // This will go forever, even if the script somehow gets in a permanent loop eating up resources, consider just setting it to a very large number ?> Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/#findComment-735097 Share on other sites More sharing options...
genericnumber1 Posted January 12, 2009 Share Posted January 12, 2009 Try... php_flag ignore_user_abort on php_value max_execution_time 0 That's what I'd try at first. If it didn't work I'd start googling. Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/#findComment-735101 Share on other sites More sharing options...
oceans Posted January 16, 2009 Author Share Posted January 16, 2009 I placed the following in the .htaccess Options All -Indexes php_flag ignore_user_abort on Nope it is not working, further my pages fail to appear as well with an error. Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/#findComment-738045 Share on other sites More sharing options...
oceans Posted January 16, 2009 Author Share Posted January 16, 2009 Can any one add to this Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/#findComment-738125 Share on other sites More sharing options...
d.shankar Posted July 16, 2009 Share Posted July 16, 2009 Note the "true" within ignore_user_abort() <?php ignore_user_abort(TRUE); set_time_limit(0); ?> This will definitely work. Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/#findComment-876610 Share on other sites More sharing options...
oceans Posted July 20, 2009 Author Share Posted July 20, 2009 Thanks D.Shankar, its good! Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/#findComment-878437 Share on other sites More sharing options...
d.shankar Posted July 20, 2009 Share Posted July 20, 2009 if it was really helpful. please click "Topic Solved" Quote Link to comment https://forums.phpfreaks.com/topic/139817-force-complete-a-page/#findComment-878589 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.