Is there a way to kill a PHP program while it’s working? I know in Linux/Unix I can do
ps -u [username]
And it will tell me what processes are running. To stop a process I just enter
kill [process #]
With PHP is there any way to see what processes are currently running on the remote server and kill an individual program from completion? Ideally using exec()?
The reason that I ask is that I am on a shared hosting environment and I work on & test my programs directly on the server… Every now and then I’ll do something silly like enter a ridiculous number of loops, accidentally, where it can take several minutes to an hour to actually complete.
Seeing that there is virtually no information on the subject, I thought it would be an interesting question to throw out there.
Thanks!
Ask your hosting provider for SSH access and do that in Unix way. Still you can emulate shell access with a
systemfunction and friends:Disclaimer: you probably won’t be able to kill Apache processes even if you will have shell access.