As we all know, MySQL has slow query log, and we can tell that those SQL statements have performance problems based on the slow search logs. As a good partner for MySQL, PHP has the same functionality. If you use PHP-FPM to manage PHP, you can open it with the following options.
The PHP 5.3.3 was previously set as follows:
<value name= "Request_slowlog_timeout" >5s</value>
<value name= "Slowlog" >logs/php-fpm-slowlog.log</value>
The following PHP 5.3.3 are set:
Request_slowlog_timeout = 5s
Slowlog =/usr/local/php/log/php-fpm-slowlog.log
Description
Request_slowlog_timeout is how long a script can be logged to a log file
Slowlog is the path to the log file
Once turned on, if a script executes for more than a specified time, a message similar to the following is written to the specified log file:
[19-dec-2013 16:54:49] [Pool www] pid 18575
Script_filename =/home/admin/web/htdocs/sandbox_canglong/test/tt.php
[0x0000000003a00dc8] curl_exec ()/home/admin/web/htdocs/sandbox_canglong/test/tt.php:2
[0x0000000003a00cd0] Exfilter_curl_get ()/home/admin/web/htdocs/sandbox_canglong/test/tt.php:6
Log Description:
Script_filename is the entry file.
Curl_exec (): Indicates that the execution time is exceeded when the method is executed.
Exfilter_curl_get (): Describes the method for calling Curl_exec () is Exfilter_curl_get ().
The number following the colon of each line is the line number.
When turned on, there are also records in the error log file. As follows:
[19-dec-2013 15:55:37] WARNING: [Pool www] child 18575, script '/home/admin/web/htdocs/sandbox_canglong/test/tt.php ' (Request: "get/test/ tt.php ") Executing too Slow (1.006222 sec), logging
[19-dec-2013 15:55:37] Notice:child 18575 stopped for tracing
[19-dec-2013 15:55:37] Notice:about to trace 18575
[19-dec-2013 15:55:37] notice:finished Trace of 18575