Apache+PHP5运行时出现mod_fcgid出现500错误的解决方法
[重要通告]如您遇疑难杂症,本站支持知识付费业务,扫右边二维码加博主微信,可节省您宝贵时间哦!
前台有朋友安装了Apache+PHP5+MYSQL5,想多版本一起运行,同时运行PHP5.2/5.3/5.4然后都设置好了后出现
Please contact the server administrator
查看日志如下:
==============================================================
[Wed Nov 30 15:20:57 2016] [warn] [client 222.129.236.32] (OS 109)管道已结束。 : mod_fcgid: get overlap result error
[Wed Nov 30 15:20:57 2016] [error] [client 222.129.236.32] Premature end of script headers: tz.php
[Wed Nov 30 15:24:17 2016] [error] [client 222.129.236.32] File does not exist: D:/wwwroot/ttwhzg/web/favicon.ico
[Wed Nov 30 15:24:19 2016] [warn] [client 222.129.236.32] (OS 109)管道已结束。 : mod_fcgid: get overlap result error
[Wed Nov 30 15:24:19 2016] [error] [client 222.129.236.32] Premature end of script headers: tz.php
[Wed Nov 30 15:24:22 2016] [warn] [client 222.129.236.32] (OS 109)管道已结束。 : mod_fcgid: get overlap result error
[Wed Nov 30 15:24:22 2016] [error] [client 222.129.236.32] Premature end of script headers: tz.php
[Wed Nov 30 15:24:23 2016] [warn] [client 222.129.236.32] (OS 109)管道已结束。 : mod_fcgid: get overlap result error
[Wed Nov 30 15:24:23 2016] [error] [client 222.129.236.32] Premature end of script headers: tz.php
[Wed Nov 30 15:24:24 2016] [warn] [client 222.129.236.32] (OS 109)管道已结束。 : mod_fcgid: get overlap result error
[Wed Nov 30 15:24:24 2016] [error] [client 222.129.236.32] Premature end of script headers: tz.php
[Wed Nov 30 15:24:25 2016] [warn] [client 222.129.236.32] (OS 109)管道已结束。 : mod_fcgid: get overlap result error
[Wed Nov 30 15:24:25 2016] [error] [client 222.129.236.32] Premature end of script headers: tz.php
[Wed Nov 30 15:24:28 2016] [warn] [client 222.129.236.32] (OS 109)管道已结束。 : mod_fcgid: get overlap result error
[Wed Nov 30 15:24:28 2016] [error] [client 222.129.236.32] Premature end of script headers: tz.php
[Wed Nov 30 17:35:18 2016] [warn] [client 222.129.236.32] (OS 109)管道已结束。 : mod_fcgid: get overlap result error
[Wed Nov 30 17:35:18 2016] [error] [client 222.129.236.32] Premature end of script headers: tz.php
[Wed Nov 30 17:35:21 2016] [warn] [client 222.129.236.32] (OS 109)管道已结束。 : mod_fcgid: get overlap result error
================================================================
根据搜索引擎找了一些相关的资料,也很模糊;
第一类错误是脚本执行被中断,没有返回完整的http header;第二类错误是cgi程序的执行被强行中止。
根本原因是fastcgi会自动kill掉一些发呆的、长时间没有响应的进程(要不它比较快,比较省内存啊),
但是fastcgi的默认idle时间设置过于苛刻(官方文档中每个选项都有默认的时间值),
所以有些处理比较慢、需要调用外部资源的程序就有可能被误杀,所以先略微调整一下,继续观察:
<IfModule mod_fcgid.c>
IdleTimeout 600
ProcessLifeTime 3600
MaxProcessCount 8
DefaultMinClassProcessCount 3
DefaultMaxClassProcessCount 3
IPCConnectTimeout 30
IPCCommTimeout 600
#MaxRequestsPerProcess 500
</IfModule>
- IdleTimeout 发呆时限
- ProcessLifeTime 一个进程的最长生命周期,过期之后无条件kill
- MaxProcessCount 最大进程个数
- DefaultMinClassProcessCount 每个程序启动的最小进程个数
- DefaultMaxClassProcessCount 每个程序启动的最大进程个数
- IPCConnectTimeout 程序响应超时时间
- IPCCommTimeout 与程序通讯的最长时间,上面的错误有可能就是这个值设置过小造成的
- MaxRequestsPerProcess 每个进程最多完成处理个数,达成后自杀,因为PHP最多只处理500次请求。
上述选项的确切作用我也不是十分清楚,先用着这个设置,再根据情况调整。
问题未解决?付费解决问题加Q或微信 2589053300 (即Q号又微信号)右上方扫一扫可加博主微信
所写所说,是心之所感,思之所悟,行之所得;文当无敷衍,落笔求简洁。 以所舍,求所获;有所依,方所成!