pcntl_fork()返回,致命错误:调用未定义函数pcntl_fork() [英] pcntl_fork() returning, Fatal error: Call to undefined function pcntl_fork()
本文介绍了pcntl_fork()返回,致命错误:调用未定义函数pcntl_fork()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用pcntl_fork()在命令行运行XAMPP php进程。当我运行以下命令时:
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);
}
我得到:
Fatal error: Call to undefined function pcntl_fork()
有人可以建议如何解决此问题吗?
Can anyone suggest how to fix this?
推荐答案
当PHP用作Apache时,无法使用功能'pcntl_fork'模块(例如XAMPP)。您只能在CGI模式或命令行中使用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.
使用此函数将导致:'致命错误:调用未定义函数:pcntl_fork()'
来源: http://php.net/manual/en/function.pcntl-fork.php
这篇关于pcntl_fork()返回,致命错误:调用未定义函数pcntl_fork()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文