PHP Fatal error: Call to undefined function pcntl_fork()
[root@localhost www]# /usr/local/php/bin/php index.php
PHP Fatal error: Call to undefined function pcntl_fork() in /home/www/theard/threadProcessManager.php on line 69
解决办法:
1、从新编译php
./configure --enable-pcntl ``````````
2、不重新安装也可以,直接进你安装php时的源码目录ext/pcntl目录。
运行
phpize
[root@localhost pcntl]# ./configure --with-php-config=/usr/local/php/bin/php-config && make && make install
把生成的文件放到默认的目录里:
[root@localhost pcntl]# cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/pcntl.so /usr/lib/php/modules/
然后在php.ini里加上这个extension
extension=pcntl.so
如果不加直接在你的程序里加载它(用dl()函数,该函数将被取消)也可以,特别对于 php 除了cmdline还要和apache做web工作的时候,因为web服务的时候加载pnctl模块爱出问题。
测试办法
test_fork.php:
echo "This is an echo before I called the fork command\n";
$pid = pcntl_fork();
if ($pid == -1) {
die("could not fork");
} else if ($pid) {
echo "I am the parent, pid = ". $pid ."\n";
} else {
echo "I am the child, pid = ". $pid ."\n";
}
echo "This is an echo after I called the fork command\n";
?>
下一篇: SpringMVC实现文件上传
推荐阅读
-
PHP FATAL ERROR: CALL TO UNDEFINED FUNCTION BCMUL()解决办法
-
php运行出现Call to undefined function curl_init()的解决方法
-
Fatal error: Call to undefined function curl_init()解决方法
-
PHP严重致命错误处理:php Fatal error: Cannot redeclare class or function【转】
-
jQuery的$.get()函数不执行以及php端报错Uncaught Error: Call to a member function bind_param() on boolean in...
-
Fatal error: 'break' not in the 'loop' or 'switch' context in Function.php
-
Fatal error: Call to undefined function json_decode()解决办法
-
Uncaught Error: Call to undefined function imageCreateTruecolor() in ,php7中GD库打不开
-
PHP TP5内报错:Call to undefined function imagecreatefrompng()
-
PHP FATAL ERROR: CALL TO UNDEFINED FUNCTION BCMUL()解决办法