I want to run a php check for some specific running processes (I know their exe name, they are my little C++ programs and there can be more of them), detect which are not answering/responding and kill them. (PHP5.4+, Windows)
What I already know
1.To get list of processes I'm using win32ps extension => win32_ps_list_procs()
=> that gives me easy access to PID and EXE name
2.Killing the process (I'm not sure if this is the best solution on Windows, please tell me if there's a better way...) :
system('taskkill /f /pid '.$pid.' /im '.$exe_name);
//forces to kill process with given pid and image name mask
What I don't know
Is how to detect if process is not responding or not. This check is rather scheduled - so I have no problem with e.g. saving some current state data and comparing them with state data collected in the next run of this check.