| Forum

How to kill a PHP process in windows?

I am running a Laravel based PHP process in my Windows 10 system. The application is started with php artisan serve command. Sometimes even after stoping the process in command prompt with Ctrl+X, I see the logs are written.
Is there a way to identify the corresponding process id and kill it in Windows like how we use the ps -ef | grep php command in linux?

You can use the tasklist command to list down all the running tasks in the command prompt.

audiodg.exe                  14952 Services                   0     16,408 K
php.exe                      13332 Console                    2     30,108 K
cmd.exe                      11056 Console                    2      4,368 K
php.exe                       8672 Console                    2     13,788 K
svchost.exe                  13416 Services                   0      9,492 K

To find the task details by name:

tasklist | find "php"

Then you can use the taskkill command to kill specific process by giving the PID as

taskkill /F /PID 8672 
taskkill /F /PID 8672
SUCCESS: The process with PID 8672 has been terminated.

Hope this helps.