我如何识别在我的服务器上消耗CPU的php-cgi脚本

I have a lot of php-cgi from http apache when I do a ps auxw

I don't know which website/scripts is taking on my cpu.

With a pstree i see that it's apache:

 |-httpd-+-16*[httpd]
 |       `-6*[httpd---php-cgi]

How can i identify it?

Thanks alls

Once identifying a PID that is drawing CPU recourses, you can replace "PID" in the command below with the PID that you wish to investigate.

pstree -H PID

In order to highlight that process and its ancestors in the tree. you may also wish to add the -a argument to pstree in order to see which command is running that process. Again, replace "PID" with the actual PID.

pstree -H PID -a

You can use

ps eax |grep php |grep -v grep|awk '{print $1 $8}'

You can change $1 and $8 and add other values that you need $1 in my system gives me the pid (you can use to kill it) and the script running.