large httpd cpu cause php script

Hi,

Occasionaly i see some httpd processes running at quite a high CPU usage. What frustrates me is that i cannot see the cause.

I have tried running ps -fe to view the processes and see the cause but all it says is httpd, non the php file that it is running.

I have tried searching around but cant find a solution. I cant believe that there is no way to find out the php script running on the httpd process.

Does anyone know of a way to find this out?

Chris

6 Replies

Have you checked your access_log? That would most likely be the easiest way to figure out what's going on.

well the thing is, i have quite a few servers with lots of different websites on. i could go trawling through all the access logs for each site but it would be a major time saver if i could simply see which script was tied to the process.

Is there anything i cna do with the process id, or in the proc directories?

Chris

I'm not sure you can see this information in process listings. However, if you turn on apache mod_status, you should be able to see, in real-time, what requests your server is working on.

Thanx, i'll give that a go.

I dont know if this is real but here:

~~[http://www.experts-exchange.com/OS/Linux/Q21634652.html" target="blank">](http://www.experts-exchange.com/OS/Linu … 34652.html">http://www.experts-exchange.com/OS/Linux/Q_21634652.html](

At the bottom i see that someone might have what i am looking for:

They have a top or some sort of process list then they have the site and script used. Is this real?

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND

12950 apache 22 0 16992 16M 7428 D 48.6 0.4 0:07 0 httpd

12912 apache 22 0 16240 15M 7436 S 47.3 0.4 0:07 0 httpd

86-0 12950 0/4/4 _ 7.24 5 0 0.0 0.01 0.01 X.X.X.X webmail.primecare.org GET /src/left_main.php HTTP/1.1

48-0 12912 0/4/4 _ 7.32 5 0 0.0 0.01 0.01 X.X.X.X webmail.primecare.org GET /src/left_main.php HTTP/1.1

@wardy277:

86-0 12950 0/4/4 _ 7.24 5 0 0.0 0.01 0.01 X.X.X.X webmail.primecare.org GET /src/left_main.php HTTP/1.1

48-0 12912 0/4/4 _ 7.32 5 0 0.0 0.01 0.01 X.X.X.X webmail.primecare.org GET /src/leftmain.php HTTP/1.1 That's a snippet from some sort of accesslog.

Thanx for your help, that mod_status is just what i need.

Chris

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct