教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 PHP fastcgi模式大文件上传500错误

PHP fastcgi模式大文件上传500错误

发布时间:2018-10-15   编辑:jiaochengji.com
教程集为您提供PHP fastcgi模式大文件上传500错误等资源,欢迎您收藏本站,我们将为您提供最新的PHP fastcgi模式大文件上传500错误资源
在linux中增加了fastcgi php环境,结果在文件上传时如果文件小于100KB是可以上传,但大了点就提示mod_fcgid: HTTP request length 132296 (so far) exceeds MaxRequestLen (131072)错误了,意思是fastcgi限制了文件上传大小而你要上传的文件比maxrequestlen还要大啊,所以不能上传想上传就得修改一下配置了,具体步骤如。

最近在项目中中上传图片时,大约有300多K,结果报了个服务器错误,以前从未遇到过,错误的内容如下:

<span style="font-size: 14px">点击查看原图</span>

mod_fcgid: www.111cn.net HTTP request length 132296 (so far) exceeds MaxRequestLen (131072)

查了下资料,发现fastcgi默认的请求大小为131072,于是在apache配置中添加了MaxRequestLen 配置就好了。如果你只需要修改单个虚拟主机的MaxRequestLen,原来是fastcgi模式下的设置问题,需要在配置文件.htaccess或者直接在apache的配置文件http.conf 中指明,如下:

<table style="background: #fb7" border="0" cellspacing="1" cellpadding="1" width="620" align="center"> <tbody> <tr> <td bgcolor="#ffe7ce" height="27" width="464"> 代码如下</td> <td style="cursor: pointer" bgcolor="#ffe7ce" width="109" align="center" onclick="doCopy('copy4214')">复制代码</td> </tr> <tr> <td style="padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px" id="copy4214" class="copyclass" bgcolor="#ffffff" valign="top" colspan="2">

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

</td> </tr> </tbody> </table>


如果你是php apache windows环境下的话我们如下配置即可

在php.ini中找到

upload_max_filesize,及其他post_max_size、max_input_time、memory_limit、 max_execution_time配置

把上传大小修改之后重启apache 即可解决。

 

您可能感兴趣的文章:
PHP fastcgi模式大文件上传500错误
PHP fastcgi模式运行的PHP上传文件MaxRequestLen错误解决
关于CGI 和 PHP-FPM的对比分析
php中常用的4种运行方式
apache与php工作原理分析
php报错FastCGI sent in stderr “PHP Fatal error: Allowed memory size of”错误
nginx支持php吗
php fastcgi是什么?fastcgi怎么实现
php有哪些运行环境
PHP 是怎么接收到请求的?

[关闭]
~ ~