running background process

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cybercog
Forum Newbie
Posts: 20
Joined: Sat Oct 06, 2007 10:35 pm

running background process

Post 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
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

Look at this: viewtopic.php?t=72594
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply