PHP Script causing high CPU

Posted by user20996 on Server Fault See other posts from Server Fault or by user20996
Published on 2012-11-27T13:36:05Z Indexed on 2012/11/27 17:06 UTC
Read the original article Hit count: 247

Filed under:
|
|

I have a website which is causing me a major headache. There is one PHP script which is using far to much CPU, this only seem to happen when bots hit the site, I dont want to block all the bots because we need them.

I have the the process manager output:

Pid                  Owner       Priority  CPU %  Memory % Command
16943 (Trace) (Kill) specialone  0         99.4   1.0      /usr/bin/php /var/www/specialone/page.php

I ran strace -p 16943 on the process but it comes up with nothing. We have 2GB of RAM and the php memory_limit is set to 128M which should be enough.

The trouble I have is the PHP code is a Framework and the culprit page.php pulls in a lot of other PHP files so I cant debug the PHP.

Is there any way of finding out what the script is doing when its using so much CPU which will help me solve it?

© Server Fault or respective owner

Related posts about apache2

Related posts about php