Admin login failed after upgrading to 3.0.5

Discussion in 'Installation/Configuration' started by jurrien, Feb 26, 2013.

  1. jurrien

    jurrien New Member

    Hi,

    I upgraded ispconfig to version 3.0.5 and I had some problems. I'm running on Centos 5.
    First I had to change /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter the exec part to " exec /usr/bin/php-cgi -d magic_quotes_gpc=off

    Ok fine I get an admin page again but when I tried to login it rejects my password. Euhm...?

    Oke fine I click on Password Lost... I have to fill in a email adres and login. Oke the login is admin but I don't remember the email address. Is there a place in the database where I can look it up? Never filled the e-mail for a account...

    What is a way to fix this?
     
  2. jurrien

    jurrien New Member

    Also other user also cannot login with the ispconfig contral panel.

    No errors in /var/log/httpd/ log files...
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Which path was in the file before you updated it?

    This does not nescessarily mean that the password is wrong, so dont update the admin password. The same error occurs when php is not able to connect to mysql.

    Pleasecheck if your are able to login to mysql (e.g. with phpmyadmin) with the login details from file /usr/local/ispconfig/interface/lib/config.inc.php
     
  4. jurrien

    jurrien New Member

    /usr/lib/cgi-bin/php

    Yes, no problems to login into the database.
     
  5. Germanius

    Germanius Member

    Similar problem here. After upgrading from 3.0.5 RC to stable the loginpage of ISPC loads very slowly. I can not login anymore.
    No problem to login via phpmyadmin, it loads very fast.
     
  6. jurrien

    jurrien New Member

    Oke! I thought my webserver was very busy but indeed also my inlog page loads very slowly.
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    We found the reason for the first issue with the path, it is a bug in ispconfig versions before 3.0.5 which inserted a wrong path, the problem was not visible till now as the ispconfig interface had a mod_php fall back which has been removed now for security reasons.

    The second issue is most likely related to the first one, php-fcgi has a problem to connect to mysql.

    Here the steps for a short fix:

    Edit the file ispconfig vhost file:

    Centos: /etc/httpd/conf/sites-enabled/000-ispconfig.vhost
    Debian / Ubuntu: /etc/apache2/sites-enabled/000-ispconfig.vhsot

    and change the lines:

    Code:
    #  <IfModule mod_php5.c>
    #    DocumentRoot /usr/local/ispconfig/interface/web/
    #    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>
    to:

    Code:
      <IfModule mod_php5.c>
        DocumentRoot /usr/local/ispconfig/interface/web/
        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>
    Then run:

    chmod 660 /usr/local/ispconfig/interface/lib/config.inc.php

    and restart apache. Then try to login again.
     
  8. jurrien

    jurrien New Member

    I'm sorry but it is still slow and not working and I can't login with any user on the control panel.
     
  9. Germanius

    Germanius Member

    Same here.
     
  10. falko

    falko Super Moderator Howtoforge Staff

    What's your PHP version?
     
  11. jurrien

    jurrien New Member

    PHP 5.2.10 (cli) (built: Nov 13 2009 11:44:05)
    Copyright (c) 1997-2009 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
     
  12. falko

    falko Super Moderator Howtoforge Staff

    Can you open /usr/local/ispconfig/interface/lib/classes/db_mysql.inc.php and replace

    PHP:
      // constructor
      
    public function __construct($prefix '') {
        global 
    $conf;
        if(
    $prefix != ''$prefix .= '_';
        
    $this->dbHost $conf[$prefix.'db_host'];
        
    $this->dbName $conf[$prefix.'db_database'];
        
    $this->dbUser $conf[$prefix.'db_user'];
        
    $this->dbPass $conf[$prefix.'db_password'];
        
    $this->dbCharset $conf[$prefix.'db_charset'];
        
    $this->dbNewLink $conf[$prefix.'db_new_link'];
        
    $this->dbClientFlags $conf[$prefix.'db_client_flags'];
        
    parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'],$conf[$prefix.'db_password'],$conf[$prefix.'db_database']);
        
    $try 0;
        while(!
    is_null($this->connect_error) && $try 5) {
          if(
    $try 0sleep(1);

          
    $try++;
          
    $this->updateError('DB::__construct');

          
    parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'],$conf[$prefix.'db_password'],$conf[$prefix.'db_database']);
        }

        if(
    is_null($this->connect_error)) $this->isConnected true;
        else return 
    false;

        
    $this->setCharacterEncoding();
      }
    with

    PHP:
      // constructor
      
    public function __construct($prefix '') {
        global 
    $conf;
        if(
    $prefix != ''$prefix .= '_';
        
    $this->dbHost $conf[$prefix.'db_host'];
        
    $this->dbName $conf[$prefix.'db_database'];
        
    $this->dbUser $conf[$prefix.'db_user'];
        
    $this->dbPass $conf[$prefix.'db_password'];
        
    $this->dbCharset $conf[$prefix.'db_charset'];
        
    $this->dbNewLink $conf[$prefix.'db_new_link'];
        
    $this->dbClientFlags $conf[$prefix.'db_client_flags'];
        
    parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'],$conf[$prefix.'db_password'],$conf[$prefix.'db_database']);
        
    $try 0;
        
    //while(!is_null($this->connect_error) && $try < 5) {
        
    while(mysqli_connect_error() && $try 5) {
          if(
    $try 0sleep(1);
          
          
    $try++;
          
    $this->updateError('DB::__construct');
          
          
    parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'],$conf[$prefix.'db_password'],$conf[$prefix.'db_database']);
        }
        
        
    //if(is_null($this->connect_error)) $this->isConnected = true;
        //else return false;
        
    if(!mysqli_connect_error()) $this->isConnected true;
        else return 
    false;
        
        
    $this->setCharacterEncoding();
      }
    as well as

    PHP:
      // error handler
      
    public function updateError($location) {
        global 
    $app;

        if(!
    is_null($this->connect_error)) {
          
    $this->errorNumber $this->connect_errno;
          
    $this->errorMessage $this->connect_error;
        } else {
          
    $this->errorNumber $this->errno;
          
    $this->errorMessage $this->error;
        }

        
    $this->errorLocation $location;
        if(
    $this->errorNumber) {
          
    $error_msg $this->errorLocation .' '$this->errorMessage;
          
    // This right here will allow us to use the samefile for server & interface
          
    if($this->show_error_messages) {
            echo 
    $error_msg;
          } else if(
    is_object($app) && method_exists($app'log')) {
            
    $app->log($error_msgLOGLEVEL_WARN);
          }
        }
      }
    with
    PHP:
      // error handler
      
    public function updateError($location) {
        global 
    $app;

        
    /*
        if(!is_null($this->connect_error)) {
          $this->errorNumber = $this->connect_errno;
          $this->errorMessage = $this->connect_error;
        } else {
          $this->errorNumber = $this->errno;
          $this->errorMessage = $this->error;
        }
        */
        
    if(mysqli_connect_error()) {
          
    $this->errorNumber mysqli_connect_errno();
          
    $this->errorMessage mysqli_connect_error();
        } else {
          
    $this->errorNumber mysqli_errno($this);
          
    $this->errorMessage mysqli_error($this);
        }


        
    $this->errorLocation $location;
        if(
    $this->errorNumber) {
          
    $error_msg $this->errorLocation .' '$this->errorMessage;
          
    // This right here will allow us to use the samefile for server & interface
          
    if($this->show_error_messages) {
        echo 
    $error_msg;
          } else if(
    is_object($app) && method_exists($app'log')) {
        
    $app->log($error_msgLOGLEVEL_WARN);
          }
        }
      }
    ? Does it work then?
     
  13. jurrien

    jurrien New Member

    Yes, for me it works again.

    Why was this the issue?
     
  14. falko

    falko Super Moderator Howtoforge Staff

  15. till

    till Super Moderator Staff Member ISPConfig Developer

    In php 5.2.9 and 5.3.0 the OO function $mysqli->connect_error is broken, so this issue is caused by a PHP bug. Since ISPConfig 3.0.5 switched from php mysql to php mysqli driver and uses the OO style functions, all servers which use one of these two PHP revisions is affected by the issue. We implemented a workaround by using the mysqli_connect_error() non "OO Style" function in the ispconfig database abstraction layer now which falko posted above. We will release a 3.0.5.1 bugfix version soon.
     
  16. jurrien

    jurrien New Member

    Ok. So I guess this is something to check before this version is applied or adjust the code so it can handle also PHP 5.2.
     
  17. jurrien

    jurrien New Member

    Ok cool! Nice job! And thanks for your help! Both of you!
     
  18. The-Ghost

    The-Ghost New Member

    Yes, this solves the problem on my server, running CentOs 5.9 :D
     
  19. jurrien

    jurrien New Member

    What is your PHP version?
     
  20. till

    till Super Moderator Staff Member ISPConfig Developer

Share This Page