PHP/HTTP max upload error

November 18th, 2011 by admin Leave a reply »

There are several reasons that you cannot upload a file with a script. The following are 2 possible reasons.

The first, simple enough, is the file size is too large. To fix this just modify the “upload_max_filesize” modifier in php.ini. To determine the location of the php.ini being used by that domain quickly create a phpinfo() page. (simple page with ) this will display the information.

note: remove this file afterwards as it gives information on your server and can be considered a security risk

The other possible reason, and you need to look at your error logs to verify this is if you are getting a similar error message to this:

 mod_fcgid: HTTP request length 138361 (so far) exceeds MaxRequestLen (131072), referer:

or something similar.

This indicates that the apache configuration needs a little tweaking.

do a quick search for the file: fcgid.conf
modify it by adding the following line

FcgidMaxRequestLen 200000000

This sets the limit to 200MB.
Example file would look like:

<IfModule mod_fcgid.c>

<IfModule !mod_fastcgi.c>
    AddHandler fcgid-script fcg fcgi fpl
</IfModule>

  FcgidIPCDir /var/run/mod_fcgid/sock
  FcgidProcessTableFile /var/run/mod_fcgid/fcgid_shm

  FcgidIdleTimeout 40
  FcgidProcessLifeTime 30
  FcgidMaxProcesses 20
  FcgidMaxProcessesPerClass 8
  FcgidMinProcessesPerClass 0
  FcgidMaxRequestLen 200000000
  FcgidConnectTimeout 30
  FcgidIOTimeout 45
  FcgidInitialEnv RAILS_ENV production
  FcgidIdleScanInterval 10

</IfModule>

if you found this helpful feel free to donate to:
ZEC: t1NQp1UuqQbmnXzazbLTSreS2AbaZpRBuTM
LTC: LZyNF1qkBUA7XFz83m5xwzGgmmj1owQn9d
BTC: 1PY95KFPTEJTR7f2NnSgaB6xB9pwDJkcJz
Advertisement

Leave a Reply

You must be logged in to post a comment.