diff options
-rw-r--r-- | lib/class/dba.class.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/class/dba.class.php b/lib/class/dba.class.php index f611751f..55608f76 100644 --- a/lib/class/dba.class.php +++ b/lib/class/dba.class.php @@ -234,7 +234,12 @@ class Dba { $port = Config::get('database_port'); // Build the data source name - $dsn = 'mysql:host=' . $hostname ?: 'localhost'; + if (strpos($hostname, '/') === 0) { + $dsn = 'mysql:unix_socket=' . $hostname; + } + else { + $dsn = 'mysql:host=' . $hostname ?: 'localhost'; + } if ($port) { $dsn .= ';port=' . intval($port); } |