我在我的服务器上使用 php_fpm_event,执行 30 秒后该进程被终止,并且我看到内部服务器错误。
但是我设置了更大的值:
[admin]
listen = 127.0.0.1:57797
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
user = admin
group = admin
pm = dynamic
pm.max_children = 30
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 6
pm.max_requests = 1000
;pm.status_path = /status
;ping.path = /ping
;ping.response = pong
request_terminate_timeout = 300s
request_slowlog_timeout = 300s
slowlog = /var/log/php-fpm/slow.log
rlimit_files = 1024
rlimit_core = 0
;chroot =
;chdir = /var/www
catch_workers_output = yes
security.limit_extensions = .php .php3 .php4 .php5
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]
;php_flag[display_errors] = off
php_admin_value[error_log] = /var/log/php-fpm/error.log
php_admin_value[session.save_path] = /var/lib/php/session
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 256M
phpinfo 确认execution_time为300秒。那么为什么会发生这种情况呢?
五分钟后我得到了这样的日志:
[17-Feb-2013 22:35:36] WARNING: [pool admin] child 7308, script '/home/admin/nowosci.org/td/odpal.php' (request: "GET /td/odpal.php") executing too slow (306.607536 sec), logging
[17-Feb-2013 22:35:44] WARNING: [pool admin] child 7308, script '/home/admin/nowosci.org/td/odpal.php' (request: "GET /td/odpal.php") execution timed out (313.981994 sec), terminating
[17-Feb-2013 22:35:44] WARNING: [pool admin] child 7308 exited on signal 15 (SIGTERM) after 679.176797 seconds from start
为什么仅 30 秒后就显示内部服务器错误?
答案1
我找到了答案:
FastCGIExternalServer "/home/admin/nowosci.org/nowosci.org.0fake" -host 127.0.0.1:57797
虽然应该有
FastCGIExternalServer "/home/admin/nowosci.org/nowosci.org.0fake" -host 127.0.0.1:57797 -idle-timeout 300