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
Properly Calling the Database from Model in an MVC Application
Required_If Laravel 5 Validation
I Have a Base64 Encoded Png, How to Write the Image to a File in PHP
Codeigniter - File Upload Required Validation
Can't Make Laravel 4 to Work on Localhost
Eloquent Parent-Child Relationship on Same Model
How to Detect If Have to Apply Utf-8 Decode or Encode on a String
How to Select Rows Where Column Value Is Not Null Using Codeigniter's Activerecord
Difference Between Eloquent\Model::Get() and All()
Change Name of Laravel's Created_At and Updated_At
PHP Rename Array Keys in Multidimensional Array
How to Create a New Joomla User Account from Within a Script
Differencebetween Null and Empty
PHP Curl Get Request and Request's Body
Error Building:Fatal Error: Pcre.H: No Such File or Directory
Syntax Error, Unexpected T_Encapsed_And_Whitespace, Expecting T_String or T_Variable or T_Num_String