mod_fcgid: read data timeout in 40 seconds

Discussion in 'General' started by FeraTechInc, Mar 29, 2010.

  1. FeraTechInc

    FeraTechInc Member HowtoForge Supporter

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

    Researching the issue I have set the

    /etc/apache2/mods-enable/fcgid.conf
    */mods-available/fcgid.conf
    */sites-enable/site.com.vhost
    <IfModule mod_fcgid.c>
    AddHandler fcgid-script .fcgi
    IdleTimeout 300
    BusyTimeout 300
    ProcessLifeTime 7200
    IPCConnectTimeout 300
    IPCCommTimeout 7200
    </IfModule>
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    If this does not help, then you should set this in the vhost of the affected website too by either adding or changing these settings in the vhost template or adding it in the apache directives field.
     
  3. FeraTechInc

    FeraTechInc Member HowtoForge Supporter

    Where is the apache directives configuration?

    This is on a 9.10 Ubuntu Perfect Server Configuration

    Also, can I keep the same format or do I need to make any changes when adding those lines to the configuration?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Site > websites > options tab

    Ypo should be able to use the same format.
     
  5. FeraTechInc

    FeraTechInc Member HowtoForge Supporter

    This worked, however, where can you set this as the server default? We have over 10 very heavy database driven websites.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Like all vhost related settings, you can set this in the vhost master template:

    /usr/local/ispconfig/server/conf/
     
  7. FeraTechInc

    FeraTechInc Member HowtoForge Supporter

    Thanks so much. I spent hours looking for this.
     
  8. FeraTechInc

    FeraTechInc Member HowtoForge Supporter

    Even with these modifications I am still getting the following error:

    Code:
    [Mon Apr 05 19:48:47 2010] [warn] mod_fcgid: read data timeout in 40 seconds
    [Mon Apr 05 19:48:47 2010] [error] [client XX.XX.XX.XX] Premature end of script headers: index.php, referer: http://www.website.com/index.php
    Any ideas? I was under the impression that "IPCCommTimeout" was what was causing the timeout... But even setting it to 7200 didn't help.
     
  9. FeraTechInc

    FeraTechInc Member HowtoForge Supporter

    This is so strange. I've tried several different PHP Settings:

    Fast-CGI
    Gives me the "mod_fcgid: read data timeout in 40 seconds" error

    CGI
    I get this error "Timeout waiting for output from CGI script"

    SuPHP
    It works but does wierd stuff with my CMS

    ModPHP
    Can't upload files because it generates strange folder permissions.
     
  10. lusso64

    lusso64 New Member

    This thread doesn't appear to have a resolution, and I am getting the very same errors.

    Here's a sample of the error.log:

    Code:
    [Tue Sep 20 20:31:32 2011] [warn] [client 58.246.122.2] Timeout waiting for output from CGI script /var/www/php-cgi-scripts/web26/php-cgi-starter
    [Tue Sep 20 20:31:33 2011] [warn] [client 180.76.5.19] Timeout waiting for output from CGI script /var/www/php-cgi-scripts/web26/php-cgi-starter
    [Tue Sep 20 20:31:36 2011] [warn] [client 66.249.68.121] Timeout waiting for output from CGI script /var/www/php-cgi-scripts/web26/php-cgi-starter
    [Tue Sep 20 20:31:53 2011] [warn] [client 180.76.5.194] Timeout waiting for output from CGI script /var/www/php-cgi-scripts/web26/php-cgi-starter
    [Tue Sep 20 20:32:43 2011] [warn] [client 66.249.68.121] Timeout waiting for output from CGI script /var/www/php-cgi-scripts/web26/php-cgi-starter
    [Tue Sep 20 20:32:43 2011] [error] [client 66.249.68.121] Script timed out before returning headers: php-cgi-starter
    [Tue Sep 20 20:33:01 2011] [warn] [client 180.76.5.155] Timeout waiting for output from CGI script /var/www/php-cgi-scripts/web26/php-cgi-starter
    [Tue Sep 20 20:33:01 2011] [error] [client 180.76.5.155] Script timed out before returning headers: php-cgi-starter
    [Tue Sep 20 20:33:11 2011] [warn] [client 180.76.5.13] Timeout waiting for output from CGI script /var/www/php-cgi-scripts/web26/php-cgi-starter
    [Tue Sep 20 20:33:21 2011] [warn] [client 180.76.5.156] Timeout waiting for output from CGI script /var/www/php-cgi-scripts/web26/php-cgi-starter
    [Tue Sep 20 20:33:21 2011] [error] [client 180.76.5.156] Script timed out before returning headers: php-cgi-starter
    [Tue Sep 20 20:33:56 2011] [warn] [client 180.76.5.144] Timeout waiting for output from CGI script /var/www/php-cgi-scripts/web26/php-cgi-starter
    [Tue Sep 20 20:33:56 2011] [error] [client 180.76.5.144] Script timed out before returning headers: php-cgi-starter
    This is only happening on one website and it isn't the one with the greatest load. Machine is a quad Xeon, 16GB RAM, 1.2TB with separate array for the DB.

    Any insight would be greatly appreciated.
     
  11. falko

    falko Super Moderator Howtoforge Staff

  12. dan-v

    dan-v New Member

    You are correct, this is the right directive for setting the fastCGI timeout. However, in many installations, this directive is is placed in several config files, and the last one wins. So unless you hit by chance the last place where this parameter is set, you are screwed.

    It took me about a day's work to I finally figure out where to put this directive in a Debian/Linux system managed under Plesk. The files is
    /var/www/vhosts/<yourhostname>/vhost.conf

    This file vhost.conf will usually not exist, unless you have already done some non-standard vhost configuring already. So you need to create it.

    Then just put contents like:

    # set time limit to be greater than the longest reasonable php module
    # execution time
    #
    # Note: some (drupal..) modules advertize themselves as long and tell you
    # to tweak php set_time_limit(). But this is ineffective by itself, unless you
    # are running PHP as a module. For PHP in CGI and FasCGI modes, the
    # shorter of the php time limit and cgi time limit will win, so you need to
    # relax both constraints

    Code:
    <IfModule mod_fcgid.c>
    [INDENT]IPCCommTimeout  900[/INDENT]
    </IfModule>
     

Share This Page