Page 1 of 1

Fatal error: Call to undefined function pcntl_fork()

Posted: Sun May 31, 2009 10:14 am
by jaoudestudios
I am trying to take advantage of forking in php, a kind of multi-threading.

However, I keep getting an error.....Fatal error: Call to undefined function pcntl_fork(). Yet I have re-compiled the latest version of php 5.2.9 with --enable-pcntl.

Any ideas what else I am missing?

Re: Fatal error: Call to undefined function pcntl_fork()

Posted: Sun May 31, 2009 12:04 pm
by Weirdan
Are you running your script from command-line?

Re: Fatal error: Call to undefined function pcntl_fork()

Posted: Sun May 31, 2009 1:40 pm
by jaoudestudios
Fixed it! Yes that was my problem. Thanks away.

How come it only runs from the command line?

Re: Fatal error: Call to undefined function pcntl_fork()

Posted: Sun May 31, 2009 2:17 pm
by Weirdan
jaoudestudios wrote:How come it only runs from the command line?
Straight from the docs:
Pcntl docs wrote:Process Control should not be enabled within a web server environment and unexpected results may happen if any Process Control functions are used within a web server environment.