[UPHPU] Forking PHP execution in a webserver

Eric Faerber php at ericfaerber.com
Thu Dec 3 12:19:06 MST 2009

Jordan Schatz wrote:
> I was wondering if anyone could enlighten me about what is the best
> practice on forking a script's execution when it is running under Apache? I
> have looked online and it seems that I should not use pcntl_fork if I am
> running under Apache. which makes sense since Apache will be trying to
> manage forking PHP to handle multiple requests...
> Mostly I want to fork to handle loging, in particular I want to send a
> text message every time a particular page is loaded. I don't want the
> page load to have to wait for the function to log in to the phone
> gataway, send the text, and get confirmation, before it finishes sending
> the page. 
> Thanks!
> Jordan
A really simple method is to put an image on the page with the src 
linking to a php page that does what you want done in the background. 
Only problem is the second script (the image one) has to finish 
processing before the user navigates away from the page.

More information about the UPHPU mailing list