问题
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.
The hhvm will throw an error as
Fatal error: forking is disallowed in server mode.
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?
回答1:
The error message looks pretty clear to me: you cannot fork in server (i.e., FastCGI) mode.
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).
来源:https://stackoverflow.com/questions/28426255/hhvm-cant-use-pcntl-fork