How to kill a running php script in windows

匿名 (未验证) 提交于 2019-12-03 08:48:34

问题:

I have a php script running in an infinite loop that I need killed without restarting apache.

I have access to the server via remote desktop. Please advise.

回答1:

Find the running scripts you want to kill:

tasklist /v | find "php"

Make note of the process ID, kill it with:

taskkill /PID 3776

Same as doing:

ps aux | grep php  kill 3776


回答2:

Have you tried:

Windows task manager->Processes->apache ?

It should be there, simply end the process.

EDIT -

Just saw that you don't want to kill apache.

I'm not sure that's possible, as PHP runs as an apache module I believe.



回答3:

In the task manager look for the apache "fork" that takes 100% of the CPU, then kill it.



回答4:

You can try this: https://serverfault.com/questions/229435/how-to-break-from-infinite-loop-caused-by-php-script-running-as-root

For future, make sure to have some secure file lock for the script:

while(true)  //script loop {    if(file_exists("STOP")) {      unlink("STOP");      exit;    }    /*Do some work*/

}



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!