problem with mysqli when using non default mysql port

We are testing webissues (version 0.8.3-1) on a Windows 2000 server running apache 2.0.61, mysql 5.0.45 and php5.2.5. The mysqli extension is used, and mysql is configured to use a non-default port different from 3306.

The recommended setting in to use 'host:port' (example: 'localhost:7306') does not work and returns the following error in the log:

[2008-01-17 17:34:57,]
WARNING in D:\InetPub\www_support\include\
mysqli_connect(): (HY000/2003): Can't connect to MySQL server on 'localhost' (10061)

I am not a php expert, but looking at the manual pages, it looks like the mysqli_connect syntax requires $port to be explicitely and separately indicated in the string.

I have made the following modifications to the files to make it work:

in file config/,

$config[ 'db_host' ] = 'host:port';

$config[ 'db_host' ] = 'host';
$config[ 'db_port' ] = 'port';

in file include/,

change line 45 from:
if ( !wi_db_connect( $config[ 'db_host' ], $config[ 'db_database' ], $config[ 'db_user' ], $config[ 'db_password' ] ) )

if ( !wi_db_connect( $config[ 'db_host' ], $config[ 'db_database' ], $config[ 'db_user' ], $config[ 'db_password' ], $config[ 'db_port' ] ) )

in file include/

change line 13 from:
function wi_db_connect( $host, $database, $user, $password )

function wi_db_connect( $host, $database, $user, $password, $port )

change line 17 from:
$db_link = mysqli_connect( $host, $user, $password, $database );

$db_link = mysqli_connect( $host, $user, $password, $database, $port );

It works for us, but there may be cleaner ways to do it. Over to the experts ;-)

You're right. I never tested

You're right. I never tested it with a non-default port number. A cleaner way to do it is to split $host into host and port in so it works the same way as with other engines. I will make fix this bug and release version 0.8.3-2 tomorrow. Thanks a lot for reporting this issue!