SoFunction
Updated on 2025-03-10

Uploading large files in PHP fastcgi mode (about 300 K) error

Recently, when uploading pictures in the project, there were about 300 K. As a result, a server error was reported. I have never encountered it before. The error content is as follows:

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

After checking the information, I found that the default request size of fastcgi is 131072, so I just added the MaxRequestLen configuration to the apache configuration. If you only need to modify the MaxRequestLen of a single virtual host, it turns out that it is a setting problem in fastcgi mode. You need to specify it in the configuration file.htaccess or directly in the apache configuration file, as follows:

The code is as follows

Copy the codeThe 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 the php+apache windows environment, we can configure it as follows

Found in

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

After modifying the upload size, restarting apache can solve the problem