How to Fix “mod_fcgid: HTTP request length 131619 (so far) exceeds MaxRequestLen (131072)” error on Ubuntu 12.04 LTS (Precise Pangolin) Linux.

If you are trying to upload a file through WordPress or another content system to your web site and your website is running on Apache2/PHP5/mod_fcgid, and your browser displays the error:

Browser error
Internal server error

and in your Apaches error log you see something like

Apaches error log
[Wed Nov 07 13:12:45 2012] [warn] [client 192.168.XXX.XXX] mod_fcgid: HTTP request length 131619 (so far) exceeds MaxRequestLen (131072), referer: …

This error is because the default value of FcgidMaxRequestLen is 131072 which is very small see Apache Module mod_fcgid for more information.

First check in your php.ini that upload_max_filesize has a big enough value for your upload. The default in php.ini is upload_max_filesize = 2M which stands for 2 megabytes (MB). If it is not set, set it to

Set php.ini
upload_max_filesize = 2M

Next edit your file /etc/apache2/mods-available/fcgid.conf, or if you have Virtualmin installed go to Webmin> Servers> Apache Webserver> and select the Global configuration tab then click Edit Config Files. Now select /etc/apache2/mods-available/fcgid.conf in the dropdown list then click the Edit Directives in File button. Either way you should see something like this.

Current directives
<IfModule mod_fcgid.c>
AddHandler    fcgid-script .fcgi
FcgidConnectTimeout 20

You now want to add the FcgidMaxRequestLen 2097152 directive to make the file look like this. NOTE: FcgidMaxRequestLen 2097152 = 2MB.

Edit directive
<IfModule mod_fcgid.c>
AddHandler    fcgid-script .fcgi
FcgidConnectTimeout 20
FcgidMaxRequestLen 2097152

Now save the changes and restart Apache with

Restart Apache
/etc/init.d/apache2 restart

Or if working in Virtualmin there is a Stop Apache link in the top right hand corner of your screen click it and when Apache has stoped the link will change to a Start Apache link. Click it also. And that is it you will now be able to upload your 2MB files.


Allan has a life time background in sales and more than thirty years experience in programming, and server configuration. Which makes Allan extremely well equipped to understand your needs for any application or web site. Contact Allan to develop an application or web site for your business or for you personally.

Leave a Reply