Can the execution time of PHP scripts be logged on Nginx

Joe Privett asked:

I have some issues with our clients reporting some of our web pages being slow. This could be for a number of reasons but I want specifically to log the execution time of each page, without having to add something into the header and footer of each PHP script. What options are there? (if it makes a difference we are running Nginx web server and PHP-FPM)

My answer:


You can use $upstream_response_time in your log_format to log the amount of time that PHP-FPM spent on a request.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.