How To Set Up Apache2 With mod_fcgid And PHP5 On Debian Etch

Discussion in 'HOWTO-Related Questions' started by immobilia, Mar 17, 2010.

  1. immobilia

    immobilia New Member

    Hy, y follow your great tutorial, but i'have some problems :

    or

    With browser result :

    I' have sometime this errors, not always... mostly on php pages calling my site himself with php_curl, and others cases...

    I use this php-fcgi-starter :

    Code:
    #!/bin/sh
    PHPRC=/etc/php5/cgi/
    export PHPRC
    export PHP_FCGI_MAX_REQUESTS=5000
    export PHP_FCGI_CHILDREN=8
    exec /usr/lib/cgi-bin/php
    And this Vhost

    Code:
    <VirtualHost *:80>
      ServerName mysite.com
      ServerAlias [url]www.mysite.com[/url]
      ServerAdmin [email][email protected][/email]
      DocumentRoot /var/www/mysite/
    
        ErrorLog /var/log/apache2/mysite-error.log
        CustomLog /var/log/apache2/mysite-access.log common
    
            <IfModule mod_fcgid.c>
                    SuexecUserGroup mysite users
                    PHP_Fix_Pathinfo_Enable 1
                    <Directory /var/www/mysite/>
                            Options +ExecCGI
                            AllowOverride All
                            AddHandler fcgid-script .php
                            FCGIWrapper /var/www/php-fcgi-scripts/mysite/php-fcgi-starter .php
                            Order allow,deny
                            Allow from all
                    </Directory>
    
    # [url]http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html[/url]
    #               IPCCommTimeout 600
    
    IPCConnectTimeout 300
    IPCCommTimeout 600
    
            </IfModule>
    
      # ErrorLog /var/log/apache2/error.log
      # CustomLog /var/log/apache2/access.log combined
      ServerSignature Off
    
    </VirtualHost>
     
  2. falko

    falko Super Moderator Howtoforge Staff

  3. kisscoolman

    kisscoolman New Member

    Same problem

    Hi there,

    I suffer from the same problem, here comes my configuration :

    Code:
    ted:~# cat /etc/php5/cgi/php.ini | grep memory_limit
    memory_limit = 128M
    
    ted:~# cat /etc/php5/cgi/php.ini | grep max_execution
    max_execution_time = 30
    
    ted:~# cat /etc/php5/cgi/php.ini | grep timeout
    default_socket_timeout = 60
    mysql.connect_timeout = 60
    
    Code:
    ted:~# cat /etc/apache2/fcgi.conf
    <IfModule mod_fcgid.c>
            AddHandler      fcgid-script .php
    
            IdleTimeout             600
            ProcessLifeTime         7200
            MaxProcessCount         1000
            DefaultMinClassProcessCount 3
            DefaultMaxClassProcessCount 100
            IPCConnectTimeout       8
            IPCCommTimeout          60
    </IfModule>
    
    (this file is included in every virtualhost)

    The wrapper :
    Code:
    ted:~# cat /home/sites/XXXXX/php5-fastcgi-wrapper
    #!/bin/sh
    
    export PHP_FCGI_CHILDREN=0
    export PHP_FCGI_MAX_REQUESTS=10000
    exec /usr/bin/php5-cgi
    
    A virtualhost exemple :
    Code:
    ted:~# cat /etc/apache2/sites-available/XXXXXX.YYY/www.XXXXXX.YYY
    <VirtualHost *:80>
            ServerAdmin [email protected]
            ServerName XXXXXX.YYY
            RedirectPermanent / http://www.XXXXXX.YYY/
    </VirtualHost>
    
    <VirtualHost *:80>
            ServerAdmin [email protected]
            ServerName www.XXXXXX.YYY
            DocumentRoot /home/sites/XXXXXX/YYY/www/
    
            Include /etc/apache2/fcgi.conf
    
            <IfModule mod_fcgid.c>
                    SuexecUserGroup XXXXX XXXXX
    
                    <Directory /home/sites/XXXXX/YY/www/>
                            Options -Indexes +ExecCGI
                            AddHandler fcgid-script .php
                            FCGIWrapper /home/sites/XXXXX/php5-fastcgi-wrapper .php
                            AllowOverride FileInfo AuthConfig
                    </Directory>
            </IfModule>
    
            AddOutputFilterByType DEFLATE text/html text/css application/x-javascript application/x-shockware-flash
    
            ErrorLog /var/log/apache2/XXXXX/error.log
            CustomLog /var/log/apache2/XXXXX/access.log combined
    </VirtualHost>
    
    The errors are the same as immobilia.

    Any idea ?
     
  4. dampi

    dampi New Member

    Hi!

    You have a BusyTimeout error. The default time for a Busy Timeout is 600 seconds.
    Try adding
    Code:
    BusyTimeout 1200
    into your section of <IfModule mod_fcgid.c>

    More info about fcgid Busy Timeout: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#fcgidbusytimeout
    (the format above is new for the next Apache 2.3, in case you are using 2.2 you need to use Busy Timeout as described above)

    Hope this helps,
    Damian
     
  5. kisscoolman

    kisscoolman New Member

    Hi dampi,

    I'm trying your solution, however, I don't think it'll fix the problem in so far as when the bug comes, you don't have to wait 300 or 600 seconds ...
    The page loads during 5 to 10 seconds, then the error comes.

    I keep my fingers crossed, and i'll let you know if it fix, or not, this problem.

    Thank you.
     
  6. kisscoolman

    kisscoolman New Member

    As I tought, it didn't fix the problem :

    Code:
    ted:~# cat /etc/apache2/fcgi.conf
    <IfModule mod_fcgid.c>
            AddHandler      fcgid-script .php
    
            BusyTimeout             1200
            IdleTimeout             600
            ProcessLifeTime         7200
            MaxProcessCount         1000
            DefaultMinClassProcessCount 3
            DefaultMaxClassProcessCount 100
            IPCConnectTimeout       8
            IPCCommTimeout          60
    
    </IfModule>
    
    I made the modification yesterday, and today, I have these errors :

    Code:
    [Thu Apr 01 15:03:01 2010] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
    [Thu Apr 01 15:03:09 2010] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
    [Thu Apr 01 15:08:05 2010] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
    [Thu Apr 01 15:08:14 2010] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
    [Thu Apr 01 15:13:09 2010] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
    [Thu Apr 01 15:13:16 2010] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
    [Thu Apr 01 15:17:18 2010] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
    [Thu Apr 01 15:18:10 2010] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
    [Thu Apr 01 15:18:18 2010] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
    [Thu Apr 01 15:23:08 2010] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
    [Thu Apr 01 15:23:14 2010] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
    [Thu Apr 01 15:28:04 2010] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
    [Thu Apr 01 15:28:15 2010] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
    
    Any other idea ?
     
  7. Turbanator

    Turbanator Member HowtoForge Supporter

    Did you ever get this fixed? I have the same problem debian lenny 64.
     
  8. 4F2E4A2E

    4F2E4A2E New Member

    same same

    hi,

    i have the same error over here...
    please help!
     
  9. crypted

    crypted Member

    I am having the same problem with my ISPC3 install on Debian Lenny.

    I've noticed my CPU LOAD for WEB8 is constantly at 80-100%. It ends up locking up my machine after a couple of days.

    Anyway, I'm getting that same error in the error.log for the website.

    (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request
     
  10. falko

    falko Super Moderator Howtoforge Staff

  11. crypted

    crypted Member

    Interesting. How would we edit this without screwing up ISPC3 though?
     
  12. falko

    falko Super Moderator Howtoforge Staff

    First I'd try to manually make the changes in the configuration files to see if it helps.
     

Share This Page