I'm trying to fork a command line run XAMPP php process using pcntl_fork(). When I run the command below:
$pid = pcntl_fork(); if($pid == -1){ file_put_contents('testlog.log',"\r\nFork Test",FILE_APPEND); return 1; //error } else if($pid){ return 0; //success } else{ file_put_contents($log, 'Running...', FILE_APPEND); }
I get:
Fatal error: Call to undefined function pcntl_fork()
Can anyone suggest how to fix this?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With