Page 1 of 1

Kill running php script

Posted: Wed Jun 14, 2006 5:57 am
by anjanesh
Hi

I got a php script that went into an infinite loop and the time limit was set to 0 - I got access to shell - is there any way to kill that running script ?

Thanks

Posted: Wed Jun 14, 2006 8:45 am
by bdlang
Are you a system admin on the server? If so, you'd have to kill the running HTTPD process, e.g.

Code: Select all

for pid in `ps -axc | grep 'httpd' | awk '{print $1}'`; do kill -HUP $pid; done
or substitute 'apache' for 'httpd' in the above statement, OR find the init script and do a 'restart'

Posted: Wed Jun 14, 2006 8:50 am
by anjanesh
Nope, Im a user on a shared host with SSH access

Posted: Wed Jun 14, 2006 9:09 am
by bdlang
Well, unfortunately you'll have to contact your sysadmin (although if they're good they've spotted the issue already and dealt with it).

FYI, you can set 'max_execution_time' in your scripts with ini_set().

Posted: Wed Jun 14, 2006 9:20 am
by anjanesh
Accidentaly I had the line set_time_limit(0); !