[php] 解决HTTP request length 139072 (so far) exceeds MaxRequestLen (131072)

在用KindEditor插件上传图片的时候,出现如下错误提示界面:

20140209092501

 

然后再查看apache错误日志,发现是如下问题:

[Sun Feb 09 09:21:54.919921 2014] [:warn] [pid 4736:tid 1104] [client 127.0.0.1:51513] mod_fcgid: HTTP request length 139072 (so far) exceeds MaxRequestLen (131072)

上网查资料,发现fastcgi默认的请求大小为131072,于是在apache配置中添加了MaxRequestLen 配置就好了。

找到apache的配置文件httpd.conf文件,找到如下代码:

<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi .php
# Where to look for the php.ini file?
FcgidInitialEnv PHPRC        "d:/wamp/bin/apache/apache2.3.14/bin"
# Set PHP_FCGI_MAX_REQUESTS to greater than or equal to FcgidMaxRequestsPerProcess
# to prevent php-cgi process from exiting before all requests completed
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS      1000
# Maximum requests a process should handle before it is terminated
FcgidMaxRequestsPerProcess                 1000
# Maximum number of PHP processes
FcgidMaxProcesses                          15
# Number of seconds of idle time before a php-cgi process is terminated
FcgidIOTimeout                             120
FcgidIdleTimeout                           120
#Path to php-cgi
FcgidWrapper "d:/wamp/bin/php/php5.4/php-cgi.exe" .php
# Define the MIME-Type for ".php" files
AddType application/x-httpd-php .php
</IfModule>

添加MaxRequestLen属性:

<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi .php

MaxRequestLen  10000000000

# Where to look for the php.ini file?
FcgidInitialEnv PHPRC        "d:/wamp/bin/apache/apache2.3.14/bin"
# Set PHP_FCGI_MAX_REQUESTS to greater than or equal to FcgidMaxRequestsPerProcess
# to prevent php-cgi process from exiting before all requests completed
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS      1000
# Maximum requests a process should handle before it is terminated
FcgidMaxRequestsPerProcess                 1000
# Maximum number of PHP processes
FcgidMaxProcesses                          15
# Number of seconds of idle time before a php-cgi process is terminated
FcgidIOTimeout                             120
FcgidIdleTimeout                           120
#Path to php-cgi
FcgidWrapper "d:/wamp/bin/php/php5.4/php-cgi.exe" .php
# Define the MIME-Type for ".php" files
AddType application/x-httpd-php .php
</IfModule>

然后再重启apache就正常了!

Author: jhonse

Jhonse技术博客: http://blog.jhonse.com

Leave a Reply

Your email address will not be published. Required fields are marked *