Cannot kill PHP script

I am developing some PHP scripts on a generic Namecheap server. I accidentally made a loop that seems to last forever (or a very long time), so now I'm trying to kill it using SSH.

I looked at the list of running processes with top , found the wrong PHP script and tried to kill it with kill . However, after I kill him with this command, when I try to use ps , it still works!

ps result:

  PID TTY STAT TIME COMMAND 819520 ? S 0:00 /usr/bin/php /my/php/file.php 

I tried to kill the process again and again, but it just won’t die!

SSH is limited, so I cannot use commands like killall . What should I do?!

+4
source share
2 answers

To kill a process, you can do the following:

  • Get PID with ps -ef
  • kill him with kill -9 <pid>

Good link: When should you use kill -9?

Just for fun, an example:

 $ sleep 100 & [1] 4156 $ ps -ef | grep slee[p] me 4156 3501 0 10:34 pts/5 00:00:00 sleep 100 $ kill 4156 [1]+ Terminated sleep 100 $ ps -ef | grep slee[p] $ 
+11
source

You can use β€œps” (process status) to get the id, and then use β€œkill” to stop it.

http://linux.about.com/library/cmd/blcmdl_kill.htm

0
source

Source: https://habr.com/ru/post/1495478/


All Articles