I configured Apache 2.4 MPM Event with PHP7.3-FPM on a pretty busy web server as follows:
Timeout 90 <Proxy "unix:/run/php/php7.3-fpm.sock|fcgi://php-fpm"> ProxySet disablereuse=on timeout=90 </Proxy> <FilesMatch ".+\.php$"> SetHandler proxy:fcgi://php-fpm </FilesMatch>
The PHP config in /etc/php/7.3/fpm/php.ini is set to
The PHP-FPM is configured in /etc/php/7.3/fpm/pool.d/www.conf to
The read timeouts are configured in /etc/apache2/mods-enabled/reqtimeout.conf like this:
RequestReadTimeout header=20-120,minrate=50 RequestReadTimeout body=60-120,minrate=50
In FPM log now I can see every minute 1-2 workers for unknown requests which are killed after 90+ seconds.
[16-May-2019 09:25:32] WARNING: [pool www] child 105567, script '' (request: " ") execution timed out (113.002653 sec), terminating [16-May-2019 09:25:32] WARNING: [pool www] child 105567 exited on signal 15 (SIGTERM) after 4050.136381 seconds from start [16-May-2019 09:25:32] NOTICE: [pool www] child 110414 started
If I don't set
request_terminate_timeout to kill these workers they stay longer (~5 minutes) in state "Reading headers" and block the PHP-FPM pool.
The threads in Apache MPM seem not to get blocked anyway. Nothing is hitting the max workers values.
How can I see which script/request these PHP workers belong to? Why these scripts are running even after
max_execution_time of 60 seconds has expired? How can I avoid blocking the PHP pool by such requests?
I suspect there could be sometimes incomplete HTTPS requests which are starting the PHP worker somehow. Is there a way to avoid starting a PHP worker for these?