在ubuntu上安装php fork

时间:2011-09-23 13:08:20

标签: php configuration fork

我第一次尝试在php中使用fork。 当我使用

$pid = pcntl_fork();
if ($pid == -1) {
     die('could not fork');
} else if ($pid) {
     // we are the parent
     pcntl_wait($status); //Protect against Zombie children
} else {
     // we are the child
}
(php.net中的fork示例)时,我会收到以下错误。
Server error
The website encountered an error while retrieving http://localhost/fork.php. It may be down for maintenance or configured incorrectly.
我认为fork没有启用,所以我下载php5源代码并执行
./configure --enable-pcntl
make
make install
但我也会得到同样的错误。 哪里有问题?

1 个答案:

答案 0 :(得分:0)

执行phpinfo();并查看是否启用了pcntl。