pcntl_fork() returning, Fatal error: Call to undefined function pcntl_fork() pcntl_fork() returning, Fatal error: Call to undefined function pcntl_fork() php php

pcntl_fork() returning, Fatal error: Call to undefined function pcntl_fork()


It is not possible to use the function 'pcntl_fork' when PHP is used as Apache module (such as XAMPP). You can only use pcntl_fork in CGI mode or from command-line.

Using this function will result in: 'Fatal error: Call to undefined function: pcntl_fork()'

Source: http://php.net/manual/en/function.pcntl-fork.php


To see if it is installed, run:

php -i | grep pcntl

If it is present and enabled then the pcntl function are likely disabled, which appears to be the default in newer PHP 5.x installs. To check, run:

php -i | grep disable_functions

If you see a list of pcntl_* functions, you'll need to edit your php.ini file (inside of XAMPP) and comment out the line disable_functions=

I'd recommend you use this distribution of PHP for OS X, which has current versions and I can confirm does have the pcntl extension.


pcntl_* functions, Process Control support in PHP is not enabled by default. You have to compile the CGI or CLI version (don't used as Apache module) of PHP with --enable-pcntl configuration option when compiling PHP to enable Process Control support.

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

ref