Friday, October 23, 2009

Forking in PHP on Mac OSX using pcntl_fork

1)sudo port selfupdate
2)sudo port update outdated
3)sudo port install php5-pcntl
4)Try the following example

$pid = pcntl_fork();

if($pid) {
// parent process runs what is here
print "parent\n";
}
else {
// child process runs what is here
print "child\n";
}
?>