How to tell which script a PHP-FPM process is running

php-fpm

I use NGINX/PHP-FPM. Sometimes I see a PHP-FPM process hogging the CPU. How can I tell which script is running in that process?

I know you can configure slow logging, but a) that's historical and b) I see some evidence that it causes instability with processes not restarting properly after logging slow requests, so I don't want to use that.

Best Answer

Recent (5.4+) versions of PHP include a status page with the FPM distribution.
You can configure this separately for each process pool, to show you what is being executed.

Alternatively, you can use APC or Xcache and get status from there.

I personally like Xcache since it shows quite extensive statistics.