#260 mysqli_connect with ports

open
nobody
Core (82)
5
2013-01-23
2011-09-02
Anonymous
No

sry, this is the first bug I report, so apologies for bad form and language problems
mysqli_connect needs the port as an extra parameter therefor writing 127.0.0.1:3307 doesn't work. The port either needs to be extracted from $CONF['database_host'] (where it is supposed to be following the setup.inc.php) or you use $CONF['database_port'] like you do for pgsql and change the description in setup.inc.php

I took the first way, probably a bad choise, but I didn't know, if you had maybe any religous reasons to preserve $CONF['database_port'] for pgsql :)
so essentialy I changed in functions.inc.php
$link = @mysqli_connect ($CONF['database_host'], $CONF['database_user'], $CONF['database_password']) or $error_text .= ("<p />DEBUG INFORMATION:<br />Connect: " . mysqli_connect_error () . "$DEBUG_TEXT");
_to_
list($host, $givenPort) = explode(":", $CONF['database_host']);
$port = (int) ($givenPort ? $givenPort : (ini_get("mysqli.default_port")));
$link = @mysqli_connect ($host, $CONF['database_user'], $CONF['database_password'], '', $port) or $error_text .= ("<p />DEBUG INFORMATION:<br />Connect: " . mysqli_connect_error () . "$DEBUG_TEXT");

Discussion