Is it possible to retrieve the Windows Process ID (PID) from an instance of Microsoft Word created through a PHP COM Object?
I am using MS Word to process documents and sometimes the Background Process of MS Word get’s hung up on my server, I can see them by running:
tasklist /fi "IMAGENAME eq WINWORD.EXE"
I would like to be able to grab the PID immediately after creating the COM Object so that I can kill that specific process later and not just wipe out all of the
<?php $word = new COM("Word.Application"); //$PID = $word->SomeWayToGetPID(); -----???? ...document processing $word->Quit(); $word = NULL; ?>
NOTE: there will be multiple users simultaneously creating MS Word instances so simply comparing the list of PID’s before and after will not be accurate.