Forum


Replies: 1   Views: 256
How do i manage word processes?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by vitorsantosinfo  · 04-04-2024 - 16:57

While using TransformDocAdvMSWord for conversion, due to the large size of my template file, some processes take a long time to execute. Is there a way to terminate these 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.