From 94444d26dbef36553fa7d8b5a1bbd0f30eb008d3 Mon Sep 17 00:00:00 2001 From: pzaremba <pzaremba@infoza.pl> Date: Thu, 10 Oct 2013 15:22:15 +0200 Subject: [PATCH] Adding support for database connection on a non-standard port. Just add ":port" to the DBHOST during the installation. --- include/mysqli.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/mysqli.php b/include/mysqli.php index ad545a5db..e60a97e97 100644 --- a/include/mysqli.php +++ b/include/mysqli.php @@ -40,7 +40,13 @@ function db_connect($host, $user, $passwd, $options = array()) { //Connectr $start = microtime(true); - if(!@$__db->real_connect($host, $user, $passwd)) # nolint + $port = 3306; + if (strpos($host, ':') !== false) { + $_host = explode(':', $host); + $host = $_host[0]; + $port = (int) $_host[1]; + } + if (!@$__db->real_connect($host, $user, $passwd, null, $port)) # nolint return NULL; //Select the database, if any. -- GitLab