Home  >  Article  >  Backend Development  >  PHP fastcgi模式大文件上传出现500错误怎么办?

PHP fastcgi模式大文件上传出现500错误怎么办?

PHPz
PHPzOriginal
2016-06-06 20:34:173061browse

PHP fastcgi模式大文件上传出现500错误的解决办法:首先找到并打开“php.ini”文件;然后找到文件中的“upload_max_filesize”;最后修改上传大小并重启apache即可解决。

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,结果报了个服务器错误,以前从未遇到过,错误的内容如下:

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

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

 代码如下


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

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

在php.ini中找到

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

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

 更多相关知识,请访问PHP中文网

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