if($pid = fork() == 0) { exec("command"); } # this is all executed in the parent ... kill $pid;