我正在使用PHP-fpm和客户独立的池.
有时页面冻结,然后显示500内部服务器错误,我在错误日志中收到此类错误:
[11-Feb-2013 22:12:39] ERROR: unable to read what child say: Bad file descriptor (9) [11-Feb-2013 22:12:39] ERROR: unable to read what child say: Bad file descriptor (9) [11-Feb-2013 22:12:42] WARNING: [pool oferty] child 31186 exited on signal 11 (SIGSEGV) after 198.250454 seconds from start
我目前的设置是:
[admin] listen = 127.0.0.1:51006 listen.backlog = -1 listen.allowed_clients = 127.0.0.1 user = admin group = admin pm = dynamic pm.max_children = 10 pm.start_servers = 2 pm.min_spare_servers = 1 pm.max_spare_servers = 2 pm.max_requests = 1000 ;pm.status_path = /status ;ping.path = /ping ;ping.response = pong request_terminate_timeout = 180s request_slowlog_timeout = 180s 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 webmaster@domain.com ;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] = 128M
应该增加什么?我的服务器使用的是Intel Core i7 2600 3.4 GHz(8线程)32 GB RAM,2xSSD 120 GB软件RAID1 2x HDD 3 TB软件RAID
增加:
pm.max_children = 20 pm.min_spare_servers = 2 pm.max_spare_servers = 4 request_terminate_timeout = 300s request_slowlog_timeout = 300s
所有问题都消失了;)