ISPConfig no longer runs: 500 Internal Server error & mod_fcgid: error reading data

Discussion in 'Installation/Configuration' started by DiscipleGeek, Nov 29, 2011.

  1. DiscipleGeek

    DiscipleGeek New Member

    I've been running ISPConfig on CentOS 5.7 Final in an Amazon EC2 instance for several weeks with no problems with ISPConfig itself.

    Our server had been hitting its max in RAM and chugging out the sites, but we discovered that it's because Amazon's EC2 does not come preinstalled with swap. I got swap running and now all my sites are running fine... except ISPConfig.

    Now, when I go to the ISPConfig control panel, I get a 500 internal server error. The only logs that show anything are the apache error_log:

    Code:
    [Tue Nov 29 09:31:46 2011] [warn] [client 97.67.115.165] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
    [Tue Nov 29 09:31:46 2011] [error] [client 97.67.115.165] Premature end of script headers: index.php
    In an attempt to locate and resolve the issue myself, I searched the boards and found a couple of threads that seemed like they might have something to do with my issue:


    http://www.howtoforge.com/forums/sh...=mod_fcgid:+error+reading+data+FastCGI+server

    Unfortunately, while the issue is close, the solutions don't really fit my server, especially since the php script is ispconfig itself.

    And finally here:

    http://www.howtoforge.com/forums/sh...=mod_fcgid:+error+reading+data+FastCGI+server

    Which suggested that I run the update for ISPConfig. I did this with no change in status.

    Please help?
     
  2. stefanm

    stefanm Member HowtoForge Supporter

    Hi,

    last time I encountered this problem it was just a matter of file ownership.
    Can you take a look at your suexec.log and check whether suexec has stopped the script execution? Perhaps user:group of the files are not correct anymore?
     
  3. DiscipleGeek

    DiscipleGeek New Member

    from the suexec.log

    Code:
    [2011-11-29 13:17:01]: uid: (5003/ispconfig) gid: (5004/5004) cmd: .php-fcgi-starter
    [2011-11-29 13:17:02]: uid: (5003/ispconfig) gid: (5004/5004) cmd: .php-fcgi-starter
    
    Not being familiar with suexec, I'd say that this just indicates that it fired off, not necessarily that it blocked it, am I right?
     
  4. stefanm

    stefanm Member HowtoForge Supporter

    That looks ok. Have you tried disabling suexec for the ispconfig interface?
     
  5. Ben

    Ben ISPConfig Developer ISPConfig Developer

    From what I read when googling around for that issue, is this maybe
    - a timeout error, that the script takes too long to generate data to send
    - the request limit is reached for fcgi processes

    Can you reproduce the error anyhow?

    Does raising the loglevel in apache help to get any further details?
     
  6. DiscipleGeek

    DiscipleGeek New Member

    At the risk of sounding completely ignorant, how do I do this for just one site?

    These are the results of raising the log level to debug:

    Code:
    [Thu Dec 01 13:27:11 2011] [debug] fcgid_proc_unix.c(354): mod_fcgid: call /var/www/ispconfig/index.php with wrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter
    [Thu Dec 01 13:27:11 2011] [info] mod_fcgid: server server.gracesites.com:/var/www/ispconfig/index.php(11806) started
    [Thu Dec 01 13:27:11 2011] [warn] [client 97.67.115.165] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
    [Thu Dec 01 13:27:11 2011] [error] [client 97.67.115.165] Premature end of script headers: index.php
    [Thu Dec 01 13:27:17 2011] [info] mod_fcgid: process /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter(11806) exit(communication error), terminated by calling exit(), return code: 0
    Also, here's the contents of the php-fcgi-starter wrapper file that's referenced:


    Code:
    #!/bin/sh
    PHPRC=/etc/
    export PHPRC
    export PHP_FCGI_MAX_REQUESTS=5000
    export PHP_FCGI_CHILDREN=8
    exec /usr/bin/php -d magic_quotes_gpc=off -d session.save_path=/usr/local/ispconfig/server/temp
     
    Last edited: Dec 1, 2011
  7. stefanm

    stefanm Member HowtoForge Supporter

    For any web domain created in ispconfig you can disable suexec on the configuration page for the web domain.

    To disable suexec for the ispconfig interface, you should do the reverse of what is explained in chapter 6.3 of the ispconfig manual (you need to comment in some lines in the ispconfig vhost)
     
  8. DiscipleGeek

    DiscipleGeek New Member

    Well, the manual says to use suexec, I'd need to comment out the IfModule mod_php5 section of /etc/httpd/conf/sites-available/ispconfig.vhost so, to not use it, the reverse would be true, correct?

    Well the interesting thing is that it already was uncommented. However, the ifmodule mod_fcgid.c section was above it. On a hunch, I commented THAT out.

    The ispconfig site then went to the apache httpd.conf default directory which was a custom file the other admin that's helping had created at /var/www/html/index.html

    So apparently the ifmodule mod_php5.c was failing. Poked around a bit and saw that php.conf under the httpd/conf/conf.d/ folder had


    <IfModule prefork.c>
    LoadModule php5_module modules/libphp5.so
    </IfModule>
    <IfModule worker.c>
    LoadModule php5_module modules/libphp5-zts.so
    </IfModule>

    commented out. I uncommented and restarted apache and everything is working now. But not through fcgi. So while ispconfig is WORKING, fcgid is probably still broken. *grumble*

    Thanks for the help.
     
  9. DiscipleGeek

    DiscipleGeek New Member

    And bingo, I found the actual problem.

    As previously noted, the wrapper was written thusly:

    Code:
    #!/bin/sh
    PHPRC=/etc/
    export PHPRC
    export PHP_FCGI_MAX_REQUESTS=5000
    export PHP_FCGI_CHILDREN=8
    exec /usr/bin/php -d magic_quotes_gpc=off session.save_path=/usr/local/ispconfig/server/temp
    
    I took a look at a couple of the other websites that ispconfig had created, as well as the master php-fcgid-starter wrapper...

    they all called /usr/bin/php-cgi instead of /usr/bin/php

    I made this change and it fixed the issue completely.

    I also want to note, for anyone else that might use this as reference in the future the comment on this page:

    http://www.howtoforge.com/how-to-set-up-apache2-with-mod_fcgid-and-php5-on-ubuntu-8.10#comment-30451

    While this didn't have anything to do with my problem, in my search for a solution I'd come across several documents stating that this needed to be set, when in fact it doesn't.
     

Share This Page