Re: Launch a seperate process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, March 6, 2007 4:06 pm, Brad Fuller wrote:
> Is there a way in a php script to launch another script but output
> something
> and exit (terminating the original request) before that script
> finishes?
>
> I have a script that accepts data, does some stuff, returns a response
> and
> exits.
>
> I want that page to accept data, return a response and exit.  Then the
> stuff
> happens.
>
> Make sense?
>
> I am STFW right now, but nothing yet.
>
> Any advice is much appreciated.

http://php.net/pcntl

What you describe is called "fork" for a more general Google
experience about it.

To take a previous post a bit further:
Unless you are 100% sure that all your OTHER extensions are
thread-safe, you should not add pcntl to your web-server installation,
unless you actually LIKE random server crashes as your forked threads
stomp all over each other...

And, from hard-won recent personal experience, in Gentoo, you have to
edit /etc/make.conf or whatever it is and NOT the /etc/packages
thingie, and definitely not just USE in the ports system, because
otherwise you will find yourself a victim of Gentoo assuming one of
the following:


Oh, you said you wanted pcntl, but this is an Apache build, and that's
bad, so I'll take it out.

Oh, you said you wanted PHP CLI with pctnl, but you had Apache module
before, so I'll uninstall Apache module to give you PHP CLI.

Oh, you said you wanted Apache Module without pcntl, but you had PHP
CLI before, so I'll uninstall PHP CLI to give you Apache module.


I'm not quite sure why Gentoo package making people thought all that
was a "good idea", but it did at least give me LOTS of practice in
installing PHP under Gentoo...

Tossing pcntl and Apache into the /etc/make.conf, for some reason
beyond my ken, convinced Gentoo that I actually wanted pcntl in CLI
where it makes sense, and not in Apache module where it doesn't.

This was PHP 4 and Apache 1.3, in case that matters.

YMMV
NAIAA

PS I do not claim to actually understand the Gentoo adminstration of
software installation system.  In fact, I can categorically state that
I just do NOT "get" this system...  Oh well.  It's just my laptop, and
the REAL systems are managed by the expert.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux