Before I found a PHP configuration about returning 500 and 502 questions, today saw a brother wrote very well, recorded. There is a time-out log in the php log, but my request_terminate_timeout is set to 0, theoretically there should be no time-out. php Fatal error: Maximum execution time of seconds exceeded in ... ok, first list current configuration: php-fpm:request_ Terminate_timeout = 0php.ini:max_execution_time = 30 First Look at the comments about Request_terminate_timeout in the php-fpm file ; The timeout for serving a single request after which the worker process would; Be killed. This option should is used when the ' max_execution_time ' ini option; Does not a stop script execution for some reason. A value of ' 0 ' means ' off '.; Available units:s (econds) (default), M (inutes), H (ours), or D (ays); The Default value:0 note shows that Request_terminate_timeout applies when max_execution_time cannot terminate the script for some reason, Will kill the PHP-FPM request. Take a look at Max_execution_time's note: This sets the maximum allowable execution time before the script is aborted by the parser, which defaults to 30s. It seems that my request should have been killed by max_execution_time this setting. Well, don't forget, do an experiment:
| PHP-FPM request_terminate_timeout Settings |
0 |
15 |
| PHP.ini max_execution_time Settings |
30 |
30 |
| Execution results |
PHP has fatal error timeout log, HTTP status code is 500 |
PHP No fatal error time-out log, HTTP status code for 502,PHP-FPM log to kill the child process log |
Well, the conclusion is that the Web request PHP execution time is controlled by 2 aspects, one is PHP.ini's max_execution_time (note that the Sleep,http request waits for the response time is not counted, here is calculates the real execution time), the other is PHP-FPM Request_terminate_timeout is set, this calculates the request to start n seconds.
PHP-FPM time-out setting Request_terminate_timeout analysis