Home  >  Article  >  php教程  >  PHP fastcgi模式运行的PHP上传文件MaxRequestLen错误解决

PHP fastcgi模式运行的PHP上传文件MaxRequestLen错误解决

WBOY
WBOYOriginal
2016-05-24 08:59:551420browse

在fastcgi模式下上传文件比较大时都会提示mod_fcgid:HTTP request length 135024 (so far) exceeds MaxRequestLen (131072)错误了,看意思是长度限制了,下面来给各位介绍解决办法.

刚装好的apache2.4.9+php5.4,在使用phpmyadmin导入数据时出现服务器500错误,查看日志后发现:

mod_fcgid: HTTP request length 135024 (so far) exceeds MaxRequestLen (131072)

意思应该是请求太长了,但以前从没见过MaxRequestLen这玩意,到httpd.conf中查找,没有;又到php.ini中查找,还是没有,只好百度,原因貌似是高版本的apache的默认请求数据改小了,也有说是fcgi运行的原因,反正不管怎么样,解决方法只有一个.

在httpd.conf中添加一条

# 修改fgci请求限制

MaxRequestLen 5242880

PHP实例代码如下:

<IfModule mod_fcgid.c> 
		AddHandler    fcgid-script .fcgi 
		FcgidConnectTimeout  20 
		# to get around upload errors when uploading images increase the MaxRequestLen size to 15MB 
		MaxRequestLen  15728640 
</IfModule>

然后重启apache,就不再提示错误了.

注意:如果你只需要修改单个虚拟主机的MaxRequestLen,只需要添加到 virtualhost中就行了,如果是全局的,添加到 httpd.conf.

教程地址:

欢迎转载!但请带上文章地址^^

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn