[UPHPU] Question: Has anyone used forks before in a web app?

John lists at strictlyrockymountain.com
Fri Jun 3 03:23:42 MDT 2005


I wrote a spammer prog that did.  Basically because your on the web, you
must call an external program (cgi php, perl, whatever), and let it do the
crunching in the background.

Mine let the sender pick the group to send to, create the mailer, and then
spawned off a php-cgi with exec().  According to the docs, exec() would
run and not wait for the output to continue with the webapp part.  I knew
I didn't need to wait for feedback from it, just let it go.  But it can
turn ugly if your looking for errors or proof its running, etc.  You'll
have to build other tools that look for the process in the process list.

--
Thanks
John


> Good morning everyone,
>
> I have to do a lot of archiving of data and statistic gathering in an
> app I'm working on. This data needs to be updated in near real time and
> there are times I'd like to fork another process to take care of this
> database number crunching so the user doesn't have to wait for it to
> finish. I need to add a bunch of calculations, and I know it's
> going to make certain pages unbearably slow if the user has to wait for
> the number crunching.
>
> Has anyone used forking in a web app before? The php manual talks
> about pcntl_fork(), but in the notes it seems that you have to use it
> with php as a cgi. Is there another route I could take with this? A cron
> job running an update script isn't going to do it.
>
> I'd really appreciate any ideas.
>
> David Boucha
>
>
> _______________________________________________
>
> UPHPU mailing list
> UPHPU at uphpu.org
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net






More information about the UPHPU mailing list