IP.Board on a different port of MySQL

30 Jul 2008, 17:58

Looking at the problems which recently faced some users of IP.Board I decided to write this tutorial. It's about a problem with the connection to the database on a different port than the standard. Such problems can be seen eg on servers nazwa.pl on new database MySQL 5 available on port 3305.


Open file: /conf_global.php


Find:



$INFO['sql_host'] = 'sql_server';


Add below:



$INFO['sql_port'] = 'connection_port';


Save and upload file.


Open file: /sources/ipsclass.php


Find:



# Debug log - Don't use this on a production board!
$this->DB->obj['debug_log'] = ROOT_PATH . 'cache/sql_debug_log_'.date('m_d_y').'.cgi';
$this->DB->obj['use_debug_log'] = 0;


Add below:



if( !empty( $this->vars['sql_port'] ) )
{
if ( extension_loaded('mysqli') AND ! defined( 'FORCE_MYSQL_ONLY' ) )
{
$this->DB->obj['sql_port'] = $this->vars['sql_port'];
}
else
{
$this->DB->obj['sql_host'] = "{$this->DB->obj['sql_host']}:{$this->vars['sql_port']}";
}
}


Save and upload file.


Open file: /ips_kernel/class_db_mysql_client.php


Find:



$this->connection_id = @mysql_pconnect( $this->obj['sql_host'] ,
$this->obj['sql_user'] ,
$this->obj['sql_pass'] ,
$this->obj['force_new_connection']
);


Replace to:



if( !empty($this->obj['sql_port'] ) )
{
$this->connection_id = @mysql_pconnect( $this->obj['sql_host'] .':' .$this->obj['sql_port'] ,
$this->obj['sql_user'] ,
$this->obj['sql_pass'] ,
$this->obj['force_new_connection']
);
}
else
{
$this->connection_id = @mysql_pconnect( $this->obj['sql_host'] ,
$this->obj['sql_user'] ,
$this->obj['sql_pass'] ,
$this->obj['force_new_connection']
);
}


Save and upload file.


That's all :-)


Article category: IP.Board