[UPHPU] Forking A Script

Ken Snyder ksnyder at coremr.com
Mon Jul 23 14:13:30 MDT 2007


Ken Snyder wrote:
> I think I've got pcntl_fork() working (see below).  The tricky part is 
> that pcntl_* functions can only be called in cgi mode (i.e. from the 
> command line).  One thing that is puzzling is that $argv[0] equals 
> 'fork.php' in sleep.php.
> I haven't yet tested to see if this works on Windows.  You mention 
> Windows--are you saying that this would probably fail on Windows 2003 
> Server? (My target platforms are Win 2003 Server and CentOS Linux)
> ...
Doh!  Yes, this doesn't work on Windows: pcntl_* functions are not 
defined.  This type of forking is an interesting concept, though.

-- Ken


see http://us2.php.net/manual/en/ref.pcntl.php:

Installation

Process Control support in PHP is not enabled by default. You have to 
compile the CGI or CLI version of PHP with --enable-pcntl configuration 
option when compiling PHP to enable Process Control support.

 >>>  Note: Currently, this module will not function on non-Unix 
platforms (Windows).


More information about the UPHPU mailing list