Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #11  
Old 26th February 2013, 15:45
jurrien jurrien is offline
Junior Member
 
Join Date: Jun 2008
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by falko View Post
What's your PHP version?
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
Reply With Quote
Sponsored Links
  #12  
Old 26th February 2013, 16:07
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

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

PHP Code:
  // 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 Code:
  // 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 Code:
  // 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 Code:
  // 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?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #13  
Old 26th February 2013, 16:22
jurrien jurrien is offline
Junior Member
 
Join Date: Jun 2008
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, for me it works again.

Why was this the issue?
Reply With Quote
  #14  
Old 26th February 2013, 16:38
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

PHP 5.2 is too old for $this->connect_error (see http://www.php.net/manual/en/mysqli.construct.php ).
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #15  
Old 26th February 2013, 16:59
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,078
Thanks: 826
Thanked 5,396 Times in 4,240 Posts
Default

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.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #16  
Old 26th February 2013, 17:00
jurrien jurrien is offline
Junior Member
 
Join Date: Jun 2008
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by falko View Post
PHP 5.2 is too old for $this->connect_error (see http://www.php.net/manual/en/mysqli.construct.php ).
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.
Reply With Quote
  #17  
Old 26th February 2013, 17:01
jurrien jurrien is offline
Junior Member
 
Join Date: Jun 2008
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by till View Post
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.
Ok cool! Nice job! And thanks for your help! Both of you!
Reply With Quote
  #18  
Old 26th February 2013, 17:09
The-Ghost The-Ghost is offline
Member
 
Join Date: May 2009
Posts: 59
Thanks: 5
Thanked 6 Times in 5 Posts
Default

Quote:
Originally Posted by till View Post
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.
Yes, this solves the problem on my server, running CentOs 5.9
Reply With Quote
The Following User Says Thank You to The-Ghost For This Useful Post:
dahas (26th February 2013)
  #19  
Old 26th February 2013, 17:13
jurrien jurrien is offline
Junior Member
 
Join Date: Jun 2008
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by The-Ghost View Post
Yes, this solves the problem on my server, running CentOs 5.9
What is your PHP version?
Reply With Quote
  #20  
Old 26th February 2013, 18:35
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,078
Thanks: 826
Thanked 5,396 Times in 4,240 Posts
 
Default

A bugfix version which contains the patched mysql libs can be downloaded here:

http://www.howtoforge.com/forums/sho...1&postcount=22
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
strange fail2ban behaviour > doesn't ban specific IP Djamu Server Operation 2 13th January 2012 02:29
Being Spammed/Hacked/Probed not sure PLEASE HELP! kresser General 10 29th October 2010 17:25
Cannot login to SquirrelMail sellotape Installation/Configuration 13 26th October 2010 11:03
Anyone figured out to integrate FuzzyOCR into ISPConfig on Ubuntu? friday Installation/Configuration 16 10th May 2007 16:25
Total Frustration-HELP palkat Installation/Configuration 17 3rd September 2005 17:28


All times are GMT +2. The time now is 14:52.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.