File download getting canceled afte ~1GB of transfer - php

I have a 4GB file on my server that is served via PHP Script.
Sadly after transferring around 1GB the download is aborted and i get the following messages in the server Log:
(104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://www.domain.tld/files/?dir=downloads/Video/testvid
(104)Connection reset by peer: mod_fcgid: ap_pass_brigade failed in handle_request_ipc function, referer: http://www.domain.tld/files/?dir=downloads/Video/testvid
I googled both errors but every suggestion so far didn't work or had to do with changing the chmod on some data plesk uses which will throw errors.
Anybody any ideas? - What exactly is going wrong?
I already tried that i put this in my apache &nginx Settings for http & https:
<IfModule mod_fcgid.c>
FcgidConnectTimeout 43200
FcgidBusyTimeout 43200
FcgidIOTimeout 43200
FcgidMaxRequestLen 335544320
FcgidMaxRequestsPerProcess 20000
</IfModule>

Related

mod_fcgid: read data timeout in 31 seconds

I am getting 2 errors as mentioned below.
[Fri Jan 09 04:10:23 2015] [warn] [client 188.165.15.22] mod_fcgid: read data timeout in 31 seconds
[Fri Jan 09 04:10:23 2015] [error] [client 188.165.15.22] Premature end of script headers: index.php
I checked this Premature end of script headers: index.php, mod_fcgid: read data timeout in 61 seconds also. But I do not have any file like /etc/httpd/conf.d/fcgid.conf to edit.
Does anybody have any idea?
I don't think that there might be any issue with php script as it as been working fine from past 1 year. Now all of sudden it has stopped working.
My Apache version is 2.2.22 and PHP Version 5.3.10-1ubuntu3.13
Content of fcgid.conf:
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
FcgidConnectTimeout 20
FcgidIOTimeout 2000
</IfModule>
You can increase the timeout as indicated in the other post:
FcgidIOTimeout 600
But since you are on Ubuntu, you'll find the relevant configuration file here:
/etc/apache2/mods-available/fcgid.conf
For me it was 41 seconds and it was coming from the httpd.conf file of the site
# /etc/apache2/sites-available/website.com.conf
<VirtualHost ipv4:80 [ipv6]:80>
IPCCommTimeout 600 #increased from 41
</VirtualHost>
If you're using FcgidCmdOptions, see answer to this question - mod_fcgid read timeout from pipe, end of script output before headers, multiple versions of PHP . In short - global options are ignored for the program specified in FcgidCmdOptions, so all timeouts have to be configured directly in this instruction.

(104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server

I am using a Ubuntu 12 Server with Plesk 12 running on it.
I get the following-error in irregular distances which ends up with an Internal Server error!
When I reload the page it's the same problem but after about a minute the error disapears.
[time] [error] [client x.x.x.x] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://host.co/test
[time] [error] [client x.x.x.x] Premature end of script headers: index.php, referer
I have tried a lot (checking my permissions, changing the FcgidBusyTimeout, …) but it has become even worse (my subjective grading).
Can you please try to increase following setting on your server under fcgid.conf file.
FcgidIdleTimeout 3600
FcgidIdleScanInterval 480
FcgidBusyTimeout 1800
FcgidBusyScanInterval 480
FcgidZombieScanInterval 12
FcgidErrorScanInterval 12

PHP maximum execution time

In my Plesk 11, PHP 5.4.7. Apache/2.4.3 system, when I make cron jobs I get this error from error.log file.
[Tue Mar 19 21:33:18 2013] [warn] [client 88.44.55.66] mod_fcgid: read data timeout in 45 seconds
[Tue Mar 19 21:33:18 2013] [error] [client 88.44.55.66] Premature end of script headers: index.php
So I checked for execution time with this:
echo ini_get('max_execution_time');
I got this value: 1560000
It doesn't seem a timeout problem but I get timeout error?
Answer for the future reference:
Edit /etc/httpd/conf.d/fcgid.conf file with vim.
Change FcgidIOTimeout 45 to FcgidIOTimeout 600.
Restart Apache.
Then Fast CGI timeout will be solved.
That's a mod_fcgid timeout, not a PHP timeout. Take a look at the mod_fcgid documentation to find out how to change it, especially at FcgidIOTimeout.
Cron scripts if build correctly should not be run through apache. Your error shows that you are running into a timeout set by mod_fcgi.
If you access it through http in your cronjob, then it will work as a webpage request and then it may be affected by apache timeout because apache is involved in the process. You can run the php script directly with an absolute path using php interpreter to bypass apache

How to fix FastCGI timeout issues in Plesk?

PHP support is currently set to: run as Fast CGI.
I keep getting these errors in my server log:
mod_fcgid: read data timeout in 45 seconds
Premature end of script headers: index.php
Should be quick fix I think, but I cant find the file to edit. Is this something I can change from Plesk.
Anyone know how to increase the timeout?
In Plesk 12.x and similar go to Web Server Settings and set the following directives:
Additional directives for HTTP & HTTPS
FcgidBusyTimeout 300
FcgidIOTimeout 250
Above lines will change the timeout for scripts that are quiet too long and take too long to execute.
Additional nginx directives
proxy_read_timeout 300;
Above lines will change the proxy timeout.
If the problem persist, increase the values.
See also: Premature end of script headers: index.php, mod_fcgid: read data timeout
Check the screenshots for the guidance:
A solution provided in the forum of Plesk by Parallels staff
Edit the file:
/etc/httpd/conf.d/fcgid.conf
Specifically, change
FcgidIOTimeout 45
to
FcgidIOTimeout 3600
3600 seconds = 1 hour. Should be long enough for most but adjust
upwards if required. I saw one example quoting 7200 seconds in there.
Finally, restart Apache to make the new setting active.
apachectl graceful
Hope it helps
R
My solution to this was to change the PHP settings in the plesk control pannel as per the screenshot.PHP Settings
In the new version of Plesk the fcgid.conf file has moved to:
/etc/apache2/mods-available/fcgid.conf
I had some issues importing an xml file into wordpress. It kept on giving a 500 Internal Error. The error log showed:
[Wed Jul 26 13:18:00.219226 2017] [fcgid:warn] [pid 4751] [client
145.97.205.8:60155] mod_fcgid: read data timeout in 45 seconds
[Wed Jul 26 13:18:00.219505 2017] [fcgid:warn] [pid 4751]
(110)Connection timed out: [client 145.97.205.8:60155] mod_fcgid:
ap_pass_brigade failed in handle_request_ipc function
After following some advice - as the PHP.INI settings made no difference - i changed some settings as advised:
Original:
FcgidIOTimeout 45
To:
FcgidIOTimeout 3600
Also added:
<IfModule mod_fcgid.c>
FcgidMaxRequestsPerProcess 500
<IfModule !mod_fastcgi.c>
Worked like a charm. Thank you for your help.
After changing max_execution_time = 3600 in /etc/php.ini solved my problem.

Php - Bulk post 500 Apache Internal Server Error

I've a script which send just a lot of data in json format
by post.
Up to about 10Mb (data are put into a flat file) of data the script works great but
if the load is higher I get from apache 500 Internal Server Error.
I peeped into apache log file I get
[Wed Jan 19 17:26:41 2011] [error] [client ip] Premature end of script headers: index.php
[Wed Jan 19 17:26:41 2011] [debug] mod_deflate.c(615): [client ip] Zlib: Compressed 632 to 385 : URL /index.php
Do you have any idea about it ?
Bye.
Premature end of script headers
This message means the PHP script died before outputing any content-type to apache. If you have ob_* functions activated it could be any error on your PHP script, or a timeout, check your set-time-limit parameter in PHP for timeouts.
Check as well that your exception handling output the correct content type if you want to output an error message.
To check all parameters that can have an impact you must check the timeout parameters and the size limits ones. Here are some of them:
Apache:
LimitRequestBody
PHP:
post_max_size
upload_max_filesize
max_input_time
max_execution_time
and maybe memory_limit as well

Categories