Jump to content

Recommended Posts

Hi gurus. I want to ask you that if start a job with php and (assume that i have 50000 records and delete or move or doing some jobs with that records) and seems it going to take long time. So is php still keep working in background after i click the submit button and then close the browser or navigate other page ???

 

Hopefully i could explain.

 

Regards

Link to comment
https://forums.phpfreaks.com/topic/159069-closing-browser/
Share on other sites

If php isn't attempting to send data back to the client, it would quit, otherwise however it may continue untill the server times out. There really isn't any hard guarantee though. To many variables can come into play.

 

You might take a look at ignore_user_abort but you might also ask yourself is php really what I'm looking for?

 

What exactly are you attempting to do?

Link to comment
https://forums.phpfreaks.com/topic/159069-closing-browser/#findComment-838871
Share on other sites

i am very glad to rapid response.

Her is my problem ; i have mailing list which contains over than 400 records. So i send mail magazine through SMTP server and takes long time to finish because i have to keep 3 seconds between each loop (sleep(3)) because of my server thinks that i am spamming.

Anyway, after i click to send button my browser wait until php finishes it jobs(which means reach to end of records) so what if i close browser or click another link. Is php stop the working ?

My compose page is Compose.php and after composing mail Send.php is getting whole records put them into a loop send mail every records.

 

Did i make you confuse ?

Link to comment
https://forums.phpfreaks.com/topic/159069-closing-browser/#findComment-838879
Share on other sites

example:

// start script as background process
exec("php /path/to/file.php > /dev/null &");

Ok...

What if i use

ignore_user_abort(1);

set_time_limit(0);

I think this way will keep working even if i close browser or navigate another page. So is set time to 0 php will never timeout until my loop finish.

Isn't this much easier way ? 

Link to comment
https://forums.phpfreaks.com/topic/159069-closing-browser/#findComment-838898
Share on other sites

don't worry about running on OS...

 

this submission was based on linux servers http://uk.php.net/manual/en/function.exec.php#88704

 

the principle is exactly the same - all you need do now is formulate the command you need to run your email and pass the relevant arguments.

 

Go step by step and make sure you can run exec on your box as a test then start investigating the path to the script you need to execute - use a test script that just sends you an email that way you won't annoy anyone if you break it.

Link to comment
https://forums.phpfreaks.com/topic/159069-closing-browser/#findComment-839861
Share on other sites

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.