Premature End of Script Headers: Index.Php, Mod_Fcgid: Read Data Timeout in 61 Seconds

Premature end of script headers: index.php, mod_fcgid: read data timeout in 61 seconds

If you can access Linux server please 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.

mod_fcgid: read data timeout in 45 seconds and Premature end of script headers: index.php

The error means that website code in index.php file fails to be executed in the time limit, which set for Apache FastCGI module and/or PHP.

  • Most likely, there is an error in the index.php, which makes it inoperable at all. In this case, you should increase the PHP error reporting level in Plesk > Domains > example.com > PHP Settings and review the script itself.

  • Less likely that script is meant to take a long time to execute. In this case, you may simply increase timeout via Plesk. To set 120 seconds instead of default 45, do the following:

1. Set max_execution_time to 120 in Plesk > Domains > example.com > PHP settings.

2. Increase FastCGI timeout by adding the following Apache dirctives in Plesk > Domains > example.com > Apache & Nginx settings > Additional Apache directives:

<IfModule mod_fcgid.c> 
FcgidIOTimeout 120
</IfModule>

mod_fcgid read timeout from pipe, end of script output before headers, multiple versions of PHP

I'm answering my own question hoping this will save someone hours of fighting with this problem.

Having spent quite a lot of time on this, I've figured our that the culprit was in using FcgidCmdOptions in vhost configuration. If it's defined, global fcgid options are simply ignored! So, instead of setting FcgidIOTimeout I had to set IOTimeout option in FcgidCmdOptions.

The final configuration is the following:

<Virtualhost *:80>
VirtualDocumentRoot "e:/hosts/example"
ServerName example.local
FcgidCmdOptions c:php/php5.5.12/php-cgi.exe \
InitialEnv PHPRC="c:php/php5.5.12/" \
InitialEnv PHP_FCGI_MAX_REQUESTS=1000 \
IOTimeout 3600 \
ConnectTimeout 3600 \
MaxProcessLifeTime 7200 \
IdleTimeout 3600 \
MaxRequestsPerProcess 900
FcgidWrapper "c:php/php5.5.12/php-cgi.exe" .php
</Virtualhost>

<Virtualhost *:81>
VirtualDocumentRoot "e:/hosts/example"
ServerName example.local
FcgidCmdOptions c:php/php7.0.12/php7-cgi.exe\
InitialEnv PHPRC="c:php/php7.0.12/" \
InitialEnv PHP_FCGI_MAX_REQUESTS=1000 \
IOTimeout 3600 \
ConnectTimeout 3600 \
MaxProcessLifeTime 7200 \
IdleTimeout 3600 \
MaxRequestsPerProcess 900
FcgidWrapper "c:php/php7.0.12/php7-cgi.exe" .php
</Virtualhost>

Timeout and premature end of script headers error in IE specifically

Have you tried disabling server compression for IE? I don't know why, I've met this error before and this fixed it for me:

RewriteEngine on

<IfModule mod_headers.c>
RewriteCond %{HTTP_USER_AGENT} MSIE\ [56]
RewriteCond %{HTTP_USER_AGENT} !SV1
RewriteCond %{REQUEST_URI} \.(css|js)$
RewriteRule .* - [E=REMOVE_IE_ACCEPT_ENCODING:1]

<LocationMatch \.(css|js)$>
RequestHeader set Accept-Encoding "" env=REMOVE_IE_ACCEPT_ENCODING
</LocationMatch>
</IfModule>

Basically modifying headers for Accept-Encoding.. but I can't find my notes on disabling compression for IE though. It's a good place to start nonetheless. Sometimes it's the optimizations that bite us in the ass.

EDIT:

After digging a bit, here's for disabling compression: http://www.aptivate.org/webguidelines/EnablingCompressionOnYourWebServer.Apache2.html



Related Topics



Leave a reply



Submit