Use the slow execution log slowlog of php-fpm to analyze PHP Execution efficiency and program bugs

Source: Internet
Author: User
Enable the slowlog log of php-fpm, view the php file that has been executed for too long, and terminate the process that has been executed for too long! See how it works! The specific operation method is also simple, modify a file, execute the command: # The viusrlocalphpetcphp-fpm.confPHP5.3.3 version before the settings are as follows: Thetimeout (

Enable the slow log of php-fpm, view php files that have been executed for too long, and terminate the processes that have been executed for too long! See how it works! The specific operation method is also simple, modify a file, execute The command: # vi/usr/local/php/etc/php-fpm.conf PHP 5.3.3 earlier version settings are as follows: The timeout (

Enable slow log of php-fpmLogs, ViewRunPHP files that are too long, andRunA process that is too long can be terminated directly! See how it works!

The specific operation method is also simple. You can modify an object,RunCommand: # vi/usr/local/php/etc/php-fpm.conf

PHP versions earlier than 5.3.3 are set as follows:

      The timeout (in seconds) for serving a single request after which the worker process will be terminated      Should be used when 'max_execution_time' ini option does not stop script execution for some reason      '0s' means 'off'      
 
  10s
       The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file      '0s' means 'off'      
 
  1s
       The log file for slow requests      
 
  logs/slow.log
 

PHP 5.3.3 and later versions are set as follows:

; The timeout for serving a single request after which a PHP backtrace will be; dumped to the 'slowlog' file. A value of '0s' means 'off '.; available units: s (econds) (default), m (inutes), h (ours), or d (ays); Default Value: 0request_slowlog_timeout = 1 s (RunMore than 1 s of php scriptsLogsRecord); The log file for slow requests; Default Value: /usr/local/php/var/log/php-fpm.log.slowslowlog =/usr/local/php/var/log/php-fpm.log.slow (turn on slowRunLogs,LogsThe directory path must exist correctly, otherwise an error will be reported); the timeout for serving a single request after which The worker process will; be killed. this option shoshould be used when the 'max _ execution_time 'ini option; does not stop script execution for some reason. A value of '0' means 'off '.; available units: s (econds) (default), m (inutes), h (ours), or d (ays); Default Value: 0request_terminate_timeout = 30 s (when a php scriptRunTerminate the php script after 30 seconds)

Note:Request_terminate_timeout willRunA process that is too long can be terminated directly.

Request_slowlog_timeout willRunSlow file writingLogs

In the future, depending on the slow speedRunLogs/Usr/local/php/var/log/slow. log to optimizeProgramFile!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.