How to know what PHP script is hanging the CPU?
Hi LQ, this is my first post here, this is a great community.
I`m interested if anyone knows how could I find what particular php script (or java program, cgi, or whatever) is hanging the CPU, and running on apache web server? Is there a module for that? Thanks. |
If you get control of the CPU again somehow, look in the Apache log to find out what the last-accessed script was.
It is important, though, to understand what you mean by "hanging". On my systems, each PHP script has a maximum time that it is permitted to run before the Apache web server kills it. In such a case, the browser that referred to the script will get no response, so it will appear that the server has hung, but in fact, the server is doing just fine. To get more information on this, see if you can have a shell session to the server in parallel with the web browser. When the browser hangs, type a command to the shell session (top is a good choice); if the server is still alive, you will get a response to your command. Immediately visit the apache access log, and look at the recent entries there. You might also look at the error log, to see if there are any complaints about scripts taking too long. A good text editor running under your shell would be a great assist. |
Thanks. I think this needs more discussion.
Quote:
Quote:
I thought there was a module for this? I tried googling but I have found nothing. |
I am not aware of any module that can do this for you.
If this were my problem to solve in a shared host environment, I think I would not try to handle the mass of logfiles manually; that is what scripts are for. Digesting a list of logfiles would be pretty easy either using awk and sed or perl, depeding on which you are comfortable with. |
All times are GMT -5. The time now is 02:11 PM. |