Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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?
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.
On my systems, each PHP script has a maximum time that it is permitted to run before the Apache web server kills it.
Yeah, but a script could be access over and over again, and system could be less responsive.
Quote:
Originally Posted by dkm999
If you get control of the CPU again somehow, look in the Apache log to find out what the last-accessed script was.
What if we are talking about shared hosting environment, where there are hundreds of separate access logs. I mean, processing them all manually would be a pain in the ass.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.