5

I created a php script that has ignore_user_abort(true); in it, and it is running in infinite loop... I closed the webpage, apache server and the browser too.. Its running like a armageddon now.. Nothing seems to stop it.. how do I stop it ?? What does it run as (process name) in windows ?? I searched for terms related to php or server or browser.. nothing seems to hit..

How do I "kill" the process now ??

Shrinath
  • 7,888
  • 13
  • 48
  • 85
  • btw, the accepted answer in this: http://stackoverflow.com/questions/265073/php-background-processes suggests he had been in this position, dude, if you are around, how can we solve this ?? – Shrinath Oct 14 '10 at 07:36
  • How do you know, that the script is still running? If you stopped Apache's process (httpd), then the script should have stopped too. – Mchl Oct 14 '10 at 11:50
  • it is updating the log file(basically a text file)... I can see the log using different process. so i know it is still running... – Shrinath Oct 14 '10 at 13:22

2 Answers2

12

http://www.mywebref.com/Code_Helper/pages/40.html seems to explain this nicely.

  1. SSH into the server
  2. Type in ps x
  3. See the list of processes currently on your server
  4. Get the PID(process id) from that list and type kill xxxxx

That should do it.

Thank you to the guy that posted that by the way. Now I know too. :)

Etienne Marais
  • 1,660
  • 1
  • 22
  • 40
  • 2
    Just to clarify the 'xxxxx' above is the PID! I'd also suggest using kill -9 xxxxx – Nev Stokes Oct 14 '10 at 08:06
  • 1
    Just to clarify: all of the above applies to linux – Mchl Oct 14 '10 at 11:47
  • You are welcome :) he he :) anyway, I am not the admin on the server, and I dont have privileges... I managed to do it by restarting the mysql server that the process was accessing :) – Shrinath Oct 14 '10 at 13:23
  • even then, just keep the thread going, I want to know how do I get the handle to this process... – Shrinath Oct 14 '10 at 13:23
  • lol :) that link you provided is a good one for this... worked for me :) Might help someone who stumbles on the same problem :) thank you :) – Shrinath Oct 16 '10 at 13:00
1

With reference to the answer by etbal, this is OK as long as the process isn't continually spawning other processes due to some error in your programming logic (happened to me :().

Then you might try

  1. SSH into the server
  2. Type in pkill -u uuuuu

where uuuu is your SSH username. That should kill ALL processes belonging to you. In my particular case, the file causing the problem kept calling itself, it had to be renamed so it couldn't call itself again, and then a pkill issued.