HHVM 不能使用 pcntl_fork [英] HHVM can't use pcntl_fork

查看:38
本文介绍了HHVM 不能使用 pcntl_fork的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 CentOs 6.5 中安装了 hhvm 3.5,它可以正确运行.但是我发现当我使用 pcntl_fork() 函数做某事时.

I've install hhvm 3.5 in my CentOs 6.5, and it could be run correctly. But I found when I use pcntl_fork() function to do something.

hhvm 会抛出一个错误

The hhvm will throw an error as

致命错误:在服务器模式下不允许分叉.

Fatal error: forking is disallowed in server mode.

它只发生在 nginx + hhvm 中,在 cli 模式下一切似乎都很好.pcntl_fork() 是否只能在 cli 模式下运行?如果不是,如何让它好起来?

It's happened just in nginx + hhvm, in cli mode everything seems alright. Does the pcntl_fork() can only run in cli mode? If not, how to make it alright?

推荐答案

错误消息在我看来很清楚:你不能在服务器(即 FastCGI)模式下分叉.

The error message looks pretty clear to me: you cannot fork in server (i.e., FastCGI) mode.

至于为什么,我只能猜测:php-fpm 在单个进程中运行单个请求.HHVM 对请求进行更复杂的多线程处理,这很容易使 fork 无法完全按照您的预期执行(如果您不仔细注意,通常会使事情处于奇怪或不一致的状态).

As to why, I can only conjecture: php-fpm runs a single request in a single process. HHVM does much more complicated multithreaded handling of requests, which can easily make fork not quite do what you expect (and generally leave things in an odd or inconsistent state if you aren't carefully paying attention).

这篇关于HHVM 不能使用 pcntl_fork的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆