我有一个服务器运行Apache / 2.2.22(Debian),PHP 5.6.17 FPM和MySQL 5.6.25。
该项目使用名为Redaxo的CMS运行(我不认为这很重要,但是我会告诉你)。 在Redaxo中有一些function需要一些时间(例如删除caching并重build需要1-2分钟)。 在这段时间,当其他用户来到网站FPM崩溃与500 Internal Server Error ,我不得不重新加载页面多次,直到服务器错误消失,并完成过程。
我注意到,只有在网站上同时有太多的用户,而且只有在繁重的操作完成时,才会发生这种情况。
10个用户在同一时间只是冲浪=没有问题
10个用户同时上网,而caching删除= 500错误给大家。
我通过禁止除了我以外的每个人的网站(.htaccess否认/允许与IP)检查了这一点。 然后我做了沉重的手术,没有问题。 一旦多人再次来到现场,问题又来了。
会是什么呢? 你需要从我那里得到什么信息?
这些值在php-fpm.conf中设置(未注释)
[global] pid = /run/php5-fpm.pid error_log = /var/log/php5-fpm.log emergency_restart_threshold = 0 include=/etc/php5/fpm/pool.d/*.conf
这些值在项目特定的fpm.conf中设置(未注释)
[projectname] user = projectname group = projectname listen = /var/run/php5-fpm-projectname.sock listen.owner = projectname listen.group = projectname listen.mode = 0660 pm = dynamic pm.max_children = 150 pm.start_servers = 10 pm.min_spare_servers = 10 pm.max_spare_servers = 30 chdir = / php_value[upload_max_filesize] = 128M php_value[max_post_size] = 128M php_value[max_execution_time] = 180 php_value[memory_limit] = 256M
当它失败的脚本与MySQL和文件创build,如果有帮助吗? 但是它很大,所以我不确定是否应该在这里发布? 或者,如果这是问题?
Apache的错误日志说这个
[Tue Feb 09 10:54:01 2016] [error] [client {IP}] (104)Connection reset by peer: FastCGI: comm with server "/fcgi-bin-php5-fpm-projectnmae" aborted: read failed [Tue Feb 09 10:54:01 2016] [error] [client {IP}] FastCGI: incomplete headers (0 bytes) received from server "/fcgi-bin-php5-fpm-projectnmae"
或这个
[Tue Feb 09 11:00:46 2016] [error] [client {IP}] FastCGI: incomplete headers (0 bytes) received from server "/fcgi-bin-php5-fpm-projectname" [Tue Feb 09 11:00:48 2016] [error] [client {IP}] (104)Connection reset by peer: FastCGI: comm with server "/fcgi-bin-php5-fpm-projectname" aborted: read failed
fpm-log表示如下。 总是当然不同的时间
[10-Feb-2016 09:40:59] WARNING: [pool projectname] child 10970 exited on signal 7 (SIGBUS) after 50.186611 seconds from start [10-Feb-2016 09:40:59] NOTICE: [pool projectname] child 11092 started
有时候会有这样的警告
[09-Feb-2016 11:00:41] WARNING: [pool projectname] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 6 total children [09-Feb-2016 11:00:42] WARNING: [pool projectname] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 7 total children
我以前见过类似的错误。 可能与PHPcaching模块有关。 尝试以下操作:
; PHP-fpm.conf: pm.max_spare_servers = 30 pm.max_requests = 200 pm.start_servers = 30 ;启用slowlog - 它给你可读的stacktrace slowlog = /var/log/php-fpm-slow.log request_slowlog_timeout = 10s listen.backlog = -1
然后检查你的PHP安装caching模块。 我已经看到在启用APC的情况下安装SIGBUS的问题。 试试这个APC模块:
#apc.ini apc.stat = 0 #或禁用它: apc.enabled = 0