NYCPHP Meetup

NYPHP.org

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

drydell at att.net drydell at att.net
Tue Aug 17 11:17:28 EDT 2004


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.
> 
> True?
> 



More information about the talk mailing list