NYCPHP Meetup

NYPHP.org

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

David Mintz dmintz at davidmintz.org
Tue Aug 17 15:51:13 EDT 2004


Hmmm, by some not-so-funny coincidence I've been going nucking futs trying
to fork on this of host of mine, too. I tried something closer to your
verbiage and it was better -- I forked, or pseudo-forked, or whatever --
but instead of returning right away, my test that slept for 15 seconds
seemed to sleep for a good... 15 seconds! Gonna try some other approach.
Sometimes your mileage really does vary quite a bit. Thanks.

On Tue, 17 Aug 2004 drydell at att.net wrote:

> I'm not a forkin' expert.. but on one host I did have a problem using the technique I described, and ended up having to force a "clean" environment by wrapping the whole thing in an env:
>
> exec("env -i /path/to/php /your/script.php 2>>/your/logfile.log >&- <&- >>/your/logfile.log");
>
> so something "bad" was being inherited by the process...
>
> >
> > I'm a total forkin' newbie, but I've read that with "real" forking, the OS
> > will make two identical copies of address spaces, one for the parent and
> > the other for the child. If parent has set $foo = 7 prior to the fork, the
> > child would see $foo = 7 as well.  Whereas in this example, we're just
> > launching another independent instance of ourself, and as such we start
> > with a clean slate.
---
David Mintz
http://davidmintz.org/

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



More information about the talk mailing list