Call to undefined function: pcntl_fork() in php-cgi 4.3

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cmarvel@nethere.com

    #1

    Call to undefined function: pcntl_fork() in php-cgi 4.3

    All:
    I have a script using php-cgi 4.3 module. The script attempts to use
    the pcntl_fork() call but gets the error message "call to undefined
    function: pcntl_fork()" instead. Anyone know what's going on?
    I have Apache 2.0+, Php-cgi 4.3 Mandrake Linux 9.1.
    Here is my fork.php script:

    #!/usr/bin/php-cgi

    <?php

    $pid = pcntl_fork();

    if ($pid == -1) {
    die('could not fork');
    } else if ($pid) {
    // we are the parent
    echo "I am the parent, pid = ". $pid ."\n";
    pcntl_wait($sta tus); //Protect against Zombie children
    } else {
    // we are the child
    echo "I am the child, pid = ". $pid ."\n";
    }

    ?>

  • Chris Hope

    #2
    Re: Call to undefined function: pcntl_fork() in php-cgi 4.3

    cmarvel@nethere .com wrote:
    [color=blue]
    > I have a script using php-cgi 4.3 module. The script attempts to
    > use
    > the pcntl_fork() call but gets the error message "call to undefined
    > function: pcntl_fork()" instead. Anyone know what's going on?
    > I have Apache 2.0+, Php-cgi 4.3 Mandrake Linux 9.1.
    > Here is my fork.php script:[/color]

    [snip]

    The pctnl_* functions are not compiled in by default. You'll probably
    need to compile it yourself to have access to these functions.

    Also note the following from http://www.php.net/manual/en/ref.pcntl.php

    "Process Control should not be enabled within a webserver environment
    and unexpected results may happen if any Process Control functions are
    used within a webserver environment."

    --
    Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com

    Comment

    • cmarvel@nethere.com

      #3
      Re: Call to undefined function: pcntl_fork() in php-cgi 4.3

      All:
      I have compiled and installed the pctnl extension code as stated in
      SELF-CONTAINED-EXTENSIONS. The pcntl_fork call still still comes up
      with undefined function error. Anyone have any ideas?

      Keith

      Comment

      • Keith

        #4
        Re: Call to undefined function: pcntl_fork() in php-cgi 4.3

        On 22 Sep 2005 06:23:44 -0700, cmarvel@nethere .com wrote:
        [color=blue]
        >All:
        > I have compiled and installed the pctnl extension code as stated in
        >SELF-CONTAINED-EXTENSIONS. The pcntl_fork call still still comes up
        >with undefined function error. Anyone have any ideas?
        >
        >Keith
        >[/color]

        All:
        I found out what the problem was. I had to fiddle with the extensions directory that php.ini looks at for extra
        extensions. Thanks all!

        Keith

        Comment

        Working...