PHP fastcgi mode upload large files of about 300 K error

  • 2021-07-21 07:36:53
  • OfStack

Recently, when uploading pictures in the project, there were about 300 K, and the result was a server error, which had never been encountered before. The contents of the error are as follows:

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

After checking the following data, it is found that the default request size of fastcgi is 131072, so it is good to add MaxRequestLen configuration to apache configuration. If you only need to modify the MaxRequestLen of a single virtual host, it is originally a setup problem in fastcgi mode, which needs to be specified in the configuration file. htaccess or directly in the configuration file http. conf of apache, as follows:

The code is as follows


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

If you are in php+apache windows environment, we can configure it as follows

Found in php. ini

upload_max_filesize, and other post_max_size, max_input_time, memory_limit, max_execution_time configurations

Modify the upload size and restart apache to solve the problem


Related articles: