Unable to upload large files via PHP: HTTP request length exceeds MaxRequestLen


2016-11-16 13:21:02 UTC


2017-08-16 17:01:30 UTC


Was this article helpful?

Have more questions?

Submit a request

Unable to upload large files via PHP: HTTP request length exceeds MaxRequestLen

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk 10.x for Linux
  • Plesk 11.x for Linux
  • Plesk 12.0 for Linux


When using PHP as FastCGI, if you try to upload a large file, the below error occurs and causes 550 internal server error or 502 Bad Gateway , if nginx support is enabled. Apache error_log contains the following error:

mod_fcgid: HTTP request length ... (so far) exceeds MaxRequestLen (1310720)

Nginx proxy_error_log contains the following error:

upstream prematurely closed connection while reading response header from upstream


The FcgidMaxRequestLen or FcgidMaxRequestInMem directives is not large enough, causing the limit to be triggered in many cases ( source ). FcgidMaxRequestInMem is required to configure due to bug in Apache ( bug #51747 )


Edit fcgid.conf file, which is depending on your linux version could be located in /etc/httpd/conf.d/ or /etc/apache2/mods-available/

Set FcgidMaxRequestLen and FcgidMaxRequestInMem with the same values and then restart Apache.

If this value is not changing, this value may be set in the virtualhost template.

  • Change this value in the template

    # grep -ir FcgidMaxRequestLen /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php
    FcgidMaxRequestLen 16777216

    # sed -i 's/FcgidMaxRequestLen 16777216/FcgidMaxRequestLen 1073741824/g' /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php

    # grep -ir FcgidMaxRequestLen /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php
    FcgidMaxRequestLen 1073741824
  • Rebuild the virtualhost configurations.

    # /usr/local/psa/admin/bin/httpdmng --reconfigure-all
    # /usr/local/psa/admin/bin/httpdmng --reconfigure-server

Also it is possible to set this at the domain level

Domains -> domain.tld -> Apache & Nginx settings -> Additional directives for HTTP & HTTPS

<IfModule mod_fcgid.c>
FcgidMaxRequestLen 1073741824
FcgidMaxRequestsPerProcess 100
FcgidProcessLifeTime 7200
Have more questions? Submit a request
Please sign in to leave a comment.