fastcgiphp

How to determine which script is being executed in PHP-FPM process


I am running nginx + php-fpm. Is there any way how can I know what is each of the PHP processes doing? Something like extended mod_status in apache, where I can see that apache process with PID x is processing URL y. I'm not sure if the PHP process knows the URL, but getting the script path and name will be sufficient.


Solution

  • After some googling hours and browsing PHP.net bug tracking system I have found the solution. It is available since PHP 5.3.8 or 5.3.9, but doesn't seem to be documented. Based on feature request #54577, the status page supports option full, which will display status of each worker separately. So for example the URL will be http://server.com/php-status?full and sample output looks like:

    pid:                  22816
    state:                Idle
    start time:           22/Feb/2013:15:03:42 +0100
    start since:          10933
    requests:             28352
    request duration:     1392
    request method:       GET
    request URI:          /ad.php?zID=597
    content length:       0
    user:                 -
    script:               /home/web/server.com/ad/ad.php
    last request cpu:     718.39
    last request memory:  1310720