To Check Process Running in Windows using PHP, we have to use PHP tasklist command with exec() function.

Complete Code to Check Process Running in Windows

Code Explanation:

  • On the above code, we use the PHP tasklist command to see what processes are running in Windows.
  • exec is the PHP inbuilt function used to execute an external program and return the last value, if there is no return then it returns the NULL value.
  • In the last line we print the $task_list variable where we store the list of running processes in windows.


You can check it by running it on you local machine using XAMP or WAMPP.

How to Kill Windows Process Using PHP

Code Explanation:

On the above code, we use the same exec() function to execute the PHP tasklist command and by using taskName from the list we can kill the process.

Here is the complete explanation about how we can check process running in windows and also kill by using the command.

To know more you can check PHP: getmypid — Manual.

Also Read:

Happy Coding..!

I am a web application developer. FB Community: @mrpandatech, Twitter: @phpcodertech My PHP problem-solving site