Sometimes it is usefull to get the PIDs from Apache or PHP which runs over FCGID to kill all the processes if it hangs up. Sometime I had that with the non thead safe version (NTS) to use its performance.
<?php
$wmi = new COM('winmgmts://');
$processes = $wmi->ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'httpd.exe'");
foreach($processes as $process){
echo 'cmd line: '. $process->CommandLine . ' --> pid: '. $process->ProcessId .'<br />';
}
//reference http://msdn2.microsoft.com/en-us/library/aa394372.aspx
?>
or replace httpd.exe with php-cgi.exe and that kill it instead of print it out.
Notice: if you want to kill php-cgi processes you have to run that script with the php module in apache ;) Otherwise the script maybe kills itself.