NYCPHP Meetup

NYPHP.org

[nycphp-talk] fork (broadcast emailer: is this sane strategy)

David Mintz dmintz at davidmintz.org
Wed Aug 18 12:39:38 EDT 2004


I investigated pcntl_fork() and friends, and read:

"Process Control should not be enabled within a webserver environment and
unexpected results may happen if any Process Control functions are used
within a webserver environment."

...and indeed it isn't enabled on my host.

(Meanwhile I'm coming up with what I believe to me a serviceable solution
to my mini-broadcast email thing: ask them not to abort the process by
hitting back or reload etc; set max_execution_time to 0;  send all the
emails while printing progress info to the screen and flush()ing;  then
output some javascrap that redirects them to a confirmation page
(apologies to Dan C. (-: )).


On Wed, 18 Aug 2004, George Schlossnagle wrote:
> On Aug 18, 2004, at 8:20 AM, ophir prusak wrote:
>
> >  I've never had to use real forks in PHP thought I have in Perl.
> >  Using the PHP exec command doesn't do "real" forking, it just creates
> > a new process in the background.
>
> How do you think that new process is created?  PHP does:
>
> if(fork() == 0) {
>    execve(newProcessExecutable, argv, envp);
> }
>
> That's how you create a new process in UNIX systems programming.

---
David Mintz
http://davidmintz.org/

        "Anybody else got a problem with Webistics?" -- Sopranos 24:17



More information about the talk mailing list