Skip to main content
pivica.me
Site about Drupal, Web Development, and other stuff...
  • Home
  • Blog
  • Projects
  • Drupal cheat sheets
  • About me
  • Contact
  1. Home
  2. Blog
  3. 500 internal server error while uploading files bigger then 100kb - mod_fcgid problem

500 internal server error while uploading files bigger then 100kb - mod_fcgid problem

  • Log in to post comments

For no special reason Drupal sites on our server (CentOS 5 with cPanel/WHM) started to make problems with file upload. Because Drupal 6/7 has use Ajax for file uploading the only thing that happens is that browser just hangs until timing out. Quick playing with different file sizes revealed that files that are less then 100kb are OK, but bigger files are creating problem. Of course php post_max_size and upload_max_filesize are set to 20mb so that was not causing problems. Strange...

Actually the biggest problem here was finding out what the hell is happening. I quickly created small html/php script with file upload form, and when testing with files bigger then 100kb I immediately got 500 internal server error - OK, that is something but still not telling much. Most annoying thing was fact that php error_log and apache logs that I was getting from Cpanel and WHM were error empty.

Yes in CentOS (managed with cPanel) you have logs all over the place. Finally founded master apache log that I needed and there was explanation

[Fri Jul 08 12:36:14 2011] [warn] [client 91.182.145.210] mod_fcgid: HTTP request length 132356 (so far) exceeds MaxRequestLen (131072), referer: http://www.montenasoft.com/.../upload.html

So MaxRequestLen from mod_fcgid (and we are running fast cgi for PHP) is limiting request length to only 130kb - If the size of the request body exceeds this amount, the request will fail with 500 Server Error. Fix is easy you just need to add in your httpd.conf next lines

# Work around annoying fcgid limitations
<ifmodule mod_fcgid.c>
  # 20MB should be enough
  MaxRequestLen 20000000
</ifmodule>

But again when you have WHM for server management things are not that easy ;) You can not just add those lines to /etc/httpd/conf/httpd.conf because next time when you update apache or php on your server your custom httpd.conf tweaks will be lost.

Here is a correct way to do, login to WHM and go to "Apache Configuration", and then select "Include Editor"

Whm anf httpd configuration 1

Then in "Pre VirtualHost Include" section select "All versions" add custom MaxRequestLen configuration, and hit update.

Whm anf httpd configuration 2

And don't forget to restart apache on the end.

Whm anf httpd configuration 3

And that was it, no more 500 internal server error. Why this setting started to make problem recently is still unknown, maybe cPanel auto updates changed something silently.

Comments

Lifesaver!

Submitted by Ted Thompson (not verified) on 21 July 2011
Permalink

This was a lifesaver! Thanks so much. I recently moved to a new VPS with WHM/cPanel CentOS, I never had this problem before on my previous server. Have spent several hours reading about people digging through system files and editing conf files, and all along the solution was in WHM.

Thanks for the heads up! Now I can get on with some work....

Ted

  • Log in to post comments

Man, You are simply the best,

Submitted by Guest (not verified) on 27 August 2011
Permalink

Man, You are simply the best, thanks a lot!

  • Log in to post comments

i am using Godaddy

Submitted by neelan (not verified) on 21 September 2011
Permalink

Can you help me to edit apace Configuration files. i am using godaddy server. and i could not find apace configuration in their control panel. please help me where it will placed to do these changes.
THnaks and waiting...

  • Log in to post comments

Sorry but I never used

Submitted by Example Editor on 24 September 2011
Permalink
Sorry but I never used Godaddy hosting...
  • Log in to post comments

That's exactly what fixed my

Submitted by Arber (not verified) on 30 December 2011
Permalink

That's exactly what fixed my problem in my dedicated server, great article (Y)

  • Log in to post comments

Can I buy you a beer over the internet?

Submitted by Danny Kopping (not verified) on 19 October 2011
Permalink

Thanks a tonne man! You really saved my ass with this blogpost :)
Thank you

  • Log in to post comments

Add my "thank you" to the list!!

Submitted by dolst (not verified) on 06 December 2011
Permalink

Thanks a bunch for this posting! I was working on a customer's Plesk site, and this was exactly the problem (even with the same symptoms, such as the cryptic and annoying empty log files!).
I believe you saved me much work, and I am very grateful!
Just FYI, this customer just upgraded their Plesk about 2 weeks ago, so this was probably the culprit. Thanks again! Surf Wisely.

  • Log in to post comments

Thank you so much!

Submitted by Ruth Cheesley (not verified) on 15 December 2011
Permalink

We had this problem and I was rummaging around trying to find config files to edit, but this worked perfectly! One very happy bunny!

Ruth

  • Log in to post comments

Sorted out my new VPS

Submitted by Chris (not verified) on 21 December 2011
Permalink

Thanks for this post, saved me a lot of head scratching for sure! Sorted out my new VPS,

  • Log in to post comments

Thank you for the tip!

Submitted by Vlad (not verified) on 01 February 2012
Permalink

Awesome, thank you very much for those published details, save me a ton of research :)

  • Log in to post comments

Thank you so much! I didn't

Submitted by Benedikt Schmitz (not verified) on 12 February 2012
Permalink

Thank you so much! I didn't search that long to fix the problem. But just because I found this awesome solution fast as hell. Thank you!

  • Log in to post comments

FcgidMaxRequestLen is 1 Gb

Submitted by Mihai Vinatoru (not verified) on 20 March 2012
Permalink

Hello,

I run a Joomla website and I get those 500 internal server errors. I checked on WHM and I have "FcgidMaxRequestLen 1073741824" (1Gb) but no use. Can you please indicate me another solution?

  • Log in to post comments

Thanks

Submitted by Eranda (not verified) on 14 July 2012
Permalink

This one worked
I also had this one in my localhost.
thnaks.

  • Log in to post comments

Thanks a lot! This fix

Submitted by Zura (not verified) on 28 October 2012
Permalink

Thanks a lot! This fix finalized my headache that lasted one week!

  • Log in to post comments

thx 4 this post mate. Very

Submitted by dezihngd (not verified) on 18 December 2012
Permalink

thx 4 this post mate. Very help full 4 me. ;)

  • Log in to post comments

Thanks so much!

Submitted by Joe (not verified) on 24 February 2013
Permalink

I just moved my site to a new server and had this same error when installing joomla extensions . Thanks so much for the easy fix!

  • Log in to post comments

Thanks!!!

Submitted by Anjali (not verified) on 16 March 2013
Permalink

That's exactly what i was looking for... Thank you so much for posting...

  • Log in to post comments

For ISPconfig and Apache2 setup

Submitted by Jon (not verified) on 01 October 2013
Permalink

Hi,

A good solid week I have been looking for this answer! Thanks so much for posting! My setup is a little different but I found the file to amend in etc/apache2/apache2.conf

Thanks again!
Jon

  • Log in to post comments

THANKS!!

Submitted by Andreas (not verified) on 21 November 2013
Permalink

After one day of struggeling I found this post! THANKS!

  • Log in to post comments
Submitted on 08 July 2011

Tags

Apache
WHM
mod_fcgi

Related blogs

Remote FTP backups of your WHM/CPanel accounts

24 June 2012

© Copyright 2025 by Ivica

  • Instagram
  • Twitter
To top