Thorough look at PHP's pcntl_fork()


Thorough look at PHP’s pcntl_fork()

Even for die-hard PHP coders, pcntl_fork() can be quite daunting. The trouble is, most PHP users have learnt to code linear, and mostly only for outputting dynamic content, like webpages.

The pcntl-functions (and to some extent the posix-functions) are different: they provide methods to program interactive applications unsuitable to run in a webenviroment like Apache. It’s quite possible to program your own webserver in PHP using these methods.

When you did some serious programming in languages like C, pcntl_fork() shouldn’t have any secrets for you. It behaves almost identically like fork() does. However, for the novice application programmers amongst us (like I am), pcntl_fork() will appear highly illogical.

Related Posts