Internal Server Error 500

Discussion in 'Installation/Configuration' started by mkreder, Jan 5, 2014.

  1. mkreder

    mkreder New Member

    Hello,

    I followed this how to http://www.howtoforge.com/perfect-server-centos-6.0-x86_64-ispconfig-3-p5 to get ISPConfig 3 installed on Centos 6.

    While trying to hit the ISPConfig page for the first time I got a 500 error.

    Checking the Apache error log I got:

    [Sun Jan 05 01:23:31 2014] [error] [client 190.16.57.3] Premature end of script headers: index.php
    [Sun Jan 05 01:23:36 2014] [warn] [client 190.16.57.3] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server

    After googling arround and reading several forum pages I checked the file /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter

    It looks exactly as it was suggested in several threads:

    #!/bin/sh
    PHPRC=/etc/
    export PHPRC
    export PHP_FCGI_MAX_REQUESTS=5000
    export PHP_FCGI_CHILDREN=8
    exec /usr/bin/php-cgi -d magic_quotes_gpc=off -d session.save_path=/usr/local/ispconfig/server/temp

    Thanks in advance. Any help will be really appreciated.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Please post the output of:

    ls -la /usr/bin/php-cgi
     
  3. mkreder

    mkreder New Member

    [[email protected] lib]# ls -la /usr/bin/php-cgi
    -rwxr-xr-x. 1 root root 3242512 Dec 10 22:34 /usr/bin/php-cgi

    I have checked permissions and several stuff and I cannot find out what is wrong. I also created a php error log but it is not showing any error.
     
  4. mkreder

    mkreder New Member

    I made the following test:

    [
    Code:
    [email protected] www]# su - ispconfig
    -bash-4.1$ PHPRC=/etc/
    -bash-4.1$ export PHPRC
    -bash-4.1$ export PHP_FCGI_MAX_REQUESTS=5000
    -bash-4.1$ export PHP_FCGI_CHILDREN=8
    -bash-4.1$ exec /usr/bin/php-cgi -d magic_quotes_gpc=off -d session.save_path=/usr/local/ispconfig/server/temp /usr/local/ispconfig/interface/web/index.php 
    X-Powered-By: PHP/5.3.3
    Set-Cookie: PHPSESSID=vggeua0e2qkn9uqrlid90ev2i6; path=/
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Content-type: text/html
    
    <!DOCTYPE html>
    <html dir="ltr" lang="en-US">      
        <head>
            <!--Possible? Vars in lang= ?-->
            <meta charset="utf-8" />
            <title>ISPConfig </title>
            <meta http-equiv="X-UA-Compatible" content="IE=9"/>
            <link href="themes/default/css/styles.css" rel="stylesheet" media="screen" type="text/css" />
            <link href="themes/default/css/print.css" rel="stylesheet" media="print" type="text/css" />
            <!--[if IE 9]><link href="themes/default/css/iehacks.css" rel="stylesheet" type="text/css" /><![endif]-->
            <!--[if lte IE 8]><script type="text/javascript" src="themes/default/js/html5shiv.js"></script><![endif]-->
            <!--[if lte IE 7]><link href="themes/default/css/iehacks.css" rel="stylesheet" type="text/css" /><![endif]-->
            <link href="themes/default/css/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
            <link rel="shortcut icon" href="/themes/default/images/favicon.ico" />
            <script type="text/javascript" src="js/jquery-1.6.3.min.js"></script>
            <script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
            <script type="text/javascript" src="js/scrigo.js.php"></script>
            <script type="text/javascript" src="js/uni-form/uni-form.jquery.js"></script>
            <script type="text/javascript" src="js/jquery.ispconfigsearch.js"></script>
            <script type="text/javascript" src="js/jquery.tipsy.js"></script>
            <script language="JavaScript" type="text/javascript">
                jQuery(document).ready(function() {
                    loadInitContent();
                    
                    $("#pageForm").submit(function(e){
                        //Prevent form submit: e.preventDefault() in lists
                        if ($(".panel #Filter").length > 0) {
                            e.preventDefault();
                        }
                    });
                    
                    jQuery('.subsectiontoggle').live("click", function(){
                        jQuery(this).children().toggleClass('showing').end().next().slideToggle();
                    });
                    
                    jQuery('#globalsearch').ispconfigSearch({
                        dataSrc: '/dashboard/ajax_get_json.php?type=globalsearch',
                        resultsLimit: '$ of % results',
                        noResultsText: 'No results.',
                        noResultsLimit: '0 results',
                        searchFieldWatermark: 'Search'
                    });
                    
                    jQuery('.ttip').tipsy({live: true, gravity: 'ne', html: true});
                    
                    tabChangeDiscard = 'n';
                    tabChangeWarning = 'n';
                    tabChangeWarningTxt = '';
                    tabChangeDiscardTxt = '';
    
                                    // Store password in browser; works in Firefox, but not Chrome
                                    $('#username').live("blur", function(){
                                            if($('#username').val() == '') {
                                                    return true;
                                            }
                                            if($('#dummy_username').val() == '' || $('#dummy_username').val() != $(this).val()){
                                                    $('#dummy_login').show();
                                                    $('#dummy_username').attr('value', $(this).val()).trigger('focus').trigger('blur');
                                                    $('#dummy_login').hide();
                                            }
                                            if($('#dummy_username').val() == $(this).val() && $(this).val() != ''){
                                                    $('#passwort').val($('#dummy_passwort').val());
                                            } else {
                                                    $('#passwort').val('');
                                            }
                                            $('#passwort').focus();
                                    });
    
                                    $('#username').live("keyup", function(){
                                            $('#dummy_username').val('');
                                            $('#dummy_passwort').val('');
                                            $('#passwort').val('');
                                    });
    
                });
                
                
                jQuery(document).bind("change", function(event) {
                    var elName = event.target.localName;
                    if (jQuery(".panel #Filter").length > 0 && elName == 'select') {
                        event.preventDefault();
                        jQuery(".panel #Filter").trigger('click');
                    }
                    if(elName == 'select' || elName == 'input' || elName == 'textarea') {
                        if(jQuery(event.target).hasClass('no-page-form-change') == false) {
                            // set marker that something was changed
                            pageFormChanged = true;
                        }
                    }
                });
                
                jQuery(document).bind("keypress", function(event) {
                    //Use jQuery submit with keypress Enter in panel filterbar
                    if (event.which == '13' && jQuery(".panel #Filter").length > 0 && jQuery(event.target).hasClass('ui-autocomplete-input') == false ) {
                        event.preventDefault();
                        jQuery(".panel #Filter").trigger('click');
                    }
                    //Use jQuery submit with keypress Enter in forms
                    if (event.which == '13' && jQuery(".pnl_formsarea button.positive").length > 0 && event.target.localName != 'textarea' && jQuery(event.target).is(':input')) {
                        event.preventDefault();
                        jQuery(".pnl_formsarea button.positive:first").not("[disabled='disabled']").trigger('click');
                    }
                });
                
                jQuery(document).delegate('.pnl_listarea th', 'click', function(event) {
                    if(jQuery(this).attr('class').length > 0 && jQuery(".panel #Filter").length > 0 && jQuery(this).hasClass('tbl_col_buttons') == false && jQuery(this).hasClass('tbl_col_limit') == false && jQuery(this).hasClass('tbl_col_nosort') == false) {
                      event.preventDefault();
                      var clickevent = jQuery('#Filter').attr('onclick');
                      var element = jQuery(this).attr('class');
                      if(typeof clickevent == 'string') {
                          jQuery('#Filter').attr('onclick', clickevent.replace(".php')", ".php?orderby=" + element + "')"));
                      }
                      jQuery(".panel #Filter").trigger('click');
                      
                      jQuery("#pageForm").ajaxComplete(function() {
                          if(jQuery("th."+element).css("background-position") == '0px -15px') {
                            if(jQuery("th."+element).css("text-align") == "right") {
                              jQuery("th."+element).css("text-align","left");
                            } else {
                              jQuery("th."+element).css("text-align","right");
                            }
                          } else {
                            jQuery(".pnl_listarea th").css("text-align","");
                          }
                          jQuery(".pnl_listarea th").css("background-position","0 0");
                          jQuery("th."+element).css("background-position","0 -15px");
                      });
                    }
                });
                
            </script>
        </head>
        <body>
            <div id="page">
                <!-- begin: header -->
                <header>
                    <nav id="topsubnav">
                        <!-- start: skip link navigation -->
                        <a class="skip" href="#navigation" title="skip link">Skip to the navigation</a><span class="hideme">.</span>
                        <a class="skip" href="#content" title="skip link">Skip to the content</a><span class="hideme">.</span>
                        <!-- end: skip link navigation -->
                                        </nav>
                    <h1 id="ir-HeaderLogo" class="swap" style="background-image:url('themes/default/images/header_logo.png');"><span>ISPConfig 3</span></h1>
                    <span>hosting control panel</span>
                </header>
                <!-- end: header -->
                <a id="navigation" name="navigation"></a><!-- skiplink anchor: navigation -->
                <!-- begin: main navigation #nav -->
                <nav id="topNav">&nbsp;</nav>
                <!-- end: main navigation -->
    
                <!-- begin: main content area #main -->
                <section id="main" name="content">
                    <nav id="sideNav" class="clearfix">&nbsp;</nav>
                    <!-- begin: #content -->
                    <section id="content">
                        <form method="post" action="" id="pageForm" name="pageForm" enctype="multipart/form-data" class="uniForm">
                            <div id="pageContent"><!-- AJAX CONTENT --></div>
                        </form>
                        <div id="ie_clearing">&nbsp;</div>
                        <!-- End: IE Column Clearing -->
                    </section>
                    <!-- end: #content -->
                </section>
                <!-- end: #main -->
                <!-- begin: footer -->
                <footer>
                    Powered by <a href="http://www.ispconfig.org/" target="_blank">ISPConfig</a>
                </footer><!-- end: footer -->
            </div>
    
    <div id="dummy_login" style="display:none;position:absolute;top:-1000px;left:-1000px;">
    <form action="" method="post" target="dummy_login" id="dummy_login_form">
    <input name="username" id="dummy_username" type="text" autocomplete="on" value="" />
    <input name="passwort" id="dummy_passwort" type="password" autocomplete="on" value="" />
    <input type="submit" value="Login" id="dummy_submit"/>
    </form>
    <iframe id="dummy_iframe" src="dummy_login.html" name="dummy_login" style="display:none;"></iframe>
    </div>
        </body>
    </html>
    Segmentation fault (core dumped)
    [[email protected] www]# 
    the HTML output is generated properly however it ends with segmentation fault. Is this normal when running php-cgi manually? what could be wrong?
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    You can not run fcgi (not cgi) manually. Fcgi is a server communication protocol that apache uses to communicte with php.

    Back to your original priblem: please check if you see ny errors in the suexec log.
     
  6. mkreder

    mkreder New Member

    suexec error log looks clean:

    Code:
    .[[email protected] httpd]# cat suexec.log 
    [2014-01-05 01:15:37]: uid: (5003/ispconfig) gid: (5004/ispconfig) cmd: .php-fcgi-starter
    [2014-01-05 01:16:25]: uid: (5003/ispconfig) gid: (5004/ispconfig) cmd: .php-fcgi-starter
    [2014-01-05 01:16:27]: uid: (5003/ispconfig) gid: (5004/ispconfig) cmd: .php-fcgi-starter
    [2014-01-05 01:16:29]: uid: (5003/ispconfig) gid: (5004/ispconfig) cmd: .php-fcgi-starter
    [2014-01-05 01:19:50]: uid: (5003/ispconfig) gid: (5004/ispconfig) cmd: .php-fcgi-starter
    [2014-01-05 01:20:33]: uid: (5003/ispconfig) gid: (5004/ispconfig) cmd: .php-fcgi-starter
    [2014-01-05 01:21:02]: uid: (5003/ispconfig) gid: (5004/ispconfig) cmd: .php-fcgi-starter
    [2014-01-05 01:21:04]: uid: (5003/ispconfig) gid: (5004/ispconfig) cmd: .php-fcgi-starter
    [2014-01-05 01:21:04]: uid: (5003/ispconfig) gid: (5004/ispconfig) cmd: .php-fcgi-starter
    The same line repeats over and over.
     
  7. mkreder

    mkreder New Member

    Still can't find a solution.

    I am running the latest ISPCP version:

    Code:
    interface/lib/config.inc.php:define('ISPC_APP_VERSION', '3.0.5.3');
    This is the vhost file for ISPC:

    Code:
    ######################################################
    # This virtual host contains the configuration
    # for the ISPConfig controlpanel
    ######################################################
    
     Listen 8080
    NameVirtualHost *:8080
    
    <VirtualHost _default_:8080>
      ServerAdmin [email protected]
      
      <IfModule mod_fcgid.c>
        DocumentRoot /var/www/ispconfig/
        SuexecUserGroup ispconfig ispconfig
        <Directory /var/www/ispconfig/>
          Options -Indexes FollowSymLinks MultiViews +ExecCGI
          AllowOverride AuthConfig Indexes Limit Options FileInfo
          AddHandler fcgid-script .php
          FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter .php
          Order allow,deny
          Allow from all
        </Directory>
        IPCCommTimeout  7200
            MaxRequestLen 15728640
      </IfModule>
      
      <IfModule mpm_itk_module>
        DocumentRoot /usr/local/ispconfig/interface/web/
            AssignUserId ispconfig ispconfig
        AddType application/x-httpd-php .php
        <Directory /usr/local/ispconfig/interface/web>
          # php_admin_value open_basedir "/usr/local/ispconfig/interface:/usr/share:/tmp"
          Options FollowSymLinks
          AllowOverride None
          Order allow,deny
          Allow from all
              php_value magic_quotes_gpc        0
        </Directory>
      </IfModule>
      
       ErrorLog /var/log/httpd/error.log
      # CustomLog /var/log/apache2/access.log combined
      ServerSignature Off
      
      <IfModule mod_security2.c>
        SecRuleEngine Off
      </IfModule>
    
      # SSL Configuration
      SSLEngine On
      SSLCertificateFile /usr/local/ispconfig/interface/ssl/ispserver.crt
      SSLCertificateKeyFile /usr/local/ispconfig/interface/ssl/ispserver.key
      #SSLCACertificateFile /usr/local/ispconfig/interface/ssl/ispserver.bundle
    
    </VirtualHost>
    
    <Directory /var/www/php-cgi-scripts>
        AllowOverride None
        Order Deny,Allow
        Deny from all
    </Directory>
    
    <Directory /var/www/php-fcgi-scripts>
        AllowOverride None
        Order Deny,Allow
        Deny from all
    </Directory>
     
  8. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    What if you put a test.php inside /usr/local/ispconfig/interface/web/ with simply
    PHP:
    <?php phpinfo(); ?>
    in it?
    Does it run?
     
  9. mkreder

    mkreder New Member

    It runs ok.

    [[email protected] ~]# vi /usr/local/ispconfig/interface/web/test.php
    [[email protected] ~]# chown ispconfig:ispconfig /usr/local/ispconfig/interface/web/test.php

    Then I tried hitting the URL /test.php and phpinfo() was displayed properly. If you need any part of the output let me know.

    /test.php works ok
    /index.php throws error 500.
     
  10. mkreder

    mkreder New Member

    After checking the differences between the guide for Centos 6 and Centos 6.3 I found out that there was a difference on the php packages installed. Then I ran:

    # yum remove php-eaccelerator
    # yum install php-pecl-apc

    And the issue got solved.
     

Share This Page