Forum


Replies: 1   Views: 101
How do i manage word processes?

Posted by admin  · 04-04-2024 - 20:35

Hello,

If the process doesn't end automatically after the PHP time limit set in the PHP configuration (or you are using an unlimited time), you can handle Windows processes using tasklist and taskkill commands with the shell_exec PHP function. For example, get the running MS Word processes:

tasklist /svc /fi "imagename eq WINWORD.exe"

or:

tasklist /svc | findstr "WINWORD"

Kill MS Word processes:

taskkill /F /IM "WINWORD.exe"

Kill a process by its PID (replace pid_value by the PID):

taskkill /PID pid_value

And the same if you want to kill php processes. For example, to kill all php.exe processes:

taskkill /F /IM "php.exe"

getmypid available in PHP returns the PHP process ID to kill a specific php PID.

Regards.