I have always used:
$pid = exec(\"/usr/local/bin/php file.php $args > /dev/null & echo \\$!\");
But I am using an XP virtual machine to
Here's a somewhat less "hacky" version of SeanDowney's answer.
PsExec returns the PID of the spawned process as its integer exit code. So all you need is this:
&1', $output, $pid);
return $pid;
} // spawn
echo spawn('phpinfo.php');
?>
The -accepteula argument is needed only the first time you run PsExec, but if you're distributing your program, each user will be running it for the first time, and it doesn't hurt anything to leave it in for each subsequent execution.
PSTools is a quick and easy install (just unzip PSTools somewhere and add its folder to your path), so there's no good reason not to use this method.