Stopping an infinite loop on a remote server PHP

LouwHopley picture LouwHopley · Sep 23, 2011 · Viewed 19k times · Source

I have a simple infinite for loop looking like this:

set_time_limit (0);
for (;;)
{
    ... //Doing some stuff including to write to a file
    sleep(300);
}

It's running on my server. (Shared hosting account)

How on earth can I stop it?

Answer

oezi picture oezi · Sep 23, 2011

kill the process. assuming you can get access to the console via ssh and your server runs on linux:

ps -ef | grep php // to get a list of php-processes

kill [process-id] // kill the process by process-id