Jump to content

Force complete a page


oceans

Recommended Posts

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.

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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
?>

Link to comment
Share on other sites

  • 6 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.