Page 1 of 1

running background process

Posted: Mon Oct 08, 2007 3:36 am
by cybercog
Hello,

I have a newsletter script that uses a form that the owner adds a subject and newsletter body and then clicks...
She then watches as the script reads through a DB recordset of email address, that it prints to the screen as they go by (they seem to like that part) and then when it's done gives them a total of successes and failures.
The whole time they can't touch that computer because the screen is still on that page.

I'd like to separate the input form function from the mailer function and have the mailer function run by itself in the background so the user can move on and use their local machine for something else (and to avoid timeout issues).

Can I start I simple php script in a seperate process from another php script?

This may sound dumb, but with all the code I've written I've never had to do this. :oops:

To do this, do I use exec()?

If I wanted to pass an array containing the form (newsletter) data to this separate script, would I use passthru()?

Would I have to lock this process to keep it from being accidentally started again while it's running?

I'm not looking for anyone to write me code, just a bit of insight.

Thanks,

- C

Posted: Mon Oct 08, 2007 6:12 am
by VladSun
Look at this: viewtopic.php?t=72594