Unable to upload large files to the website: End of script output before headers

Created:

2016-11-16 12:55:49 UTC

Modified:

2017-08-14 18:54:56 UTC

2

Was this article helpful?


Have more questions?

Submit a request

Unable to upload large files to the website: End of script output before headers

Applicable to:

  • Plesk for Linux

Symptoms

Unable to upload large files to the website.

The following errors occurs in /var/www/vhosts/domain.tld/logs/error_log :

[fcgid:warn] [pid 4820] [client 192.168.1.1:33236] mod_fcgid: error reading data, FastCGI server closed connection, referer: https://domain.tld/product_info_sdn.php?sdn_id=350648558&pid=166
[core:error] [pid 4820] [client 192.168.1.1:33236] End of script output before headers: sdn_data.php, referer: https://domain.tld/product_info_sdn.php?sdn_id=350648558&pid=166

However, all the limits are set more than enough in domain PHP configuration file:

# grep -e 'memory_limit' -e 'upload_max_filesize' -e 'post_max_size' -e 'file_uploads' /var/www/vhosts/system/domain.tld/etc/php.ini
file_uploads = on
upload_max_filesize = 256M
post_max_size = 256M
memory_limit = 256M
max_file_uploads = 20

As well as communication timeout to FastCGI server in fcgid.conf :

# grep 'FcgidIOTimeout' /etc/httpd/conf.d/fcgid.conf
FcgidIOTimeout 320

Cause

Directive LimitRequestBody is enabled at /etc/httpd/conf/httpd.conf : it overwrites the limits set at domain php.ini file.

LimitRequestBody specifies the number of bytes from 0 (meaning unlimited) to 2147483647 (2GB) that are allowed in a request body.

Resolution

Find and edit directive LimitRequestBody at /etc/httpd/conf/httpd.conf :

For example, to limit the size of the uploaded file to 10MB, use the following value:

LimitRequestBody 10485760

More information about directive LimitRequestBody can be found here:

Apache Core Features - LimitRequestBody Directive

NOTE:

If this directive is disabled, then the file upload limits specified at domain php.ini will be used instead:

# grep -e 'post_max_size' -e 'upload_max_filesize' /var/www/vhosts/system/domain.tld/etc/php.ini
upload_max_filesize = 256M
post_max_size = 256M
Have more questions? Submit a request
Please sign in to leave a comment.