include port in pdo url when host is 'localhost'

This commit is contained in:
redmatrix 2016-08-23 18:18:05 -07:00
parent 1e6a491400
commit d3369384d1

View File

@ -62,6 +62,8 @@ class DBA {
if(is_object(self::$dba) && self::$dba->connected) {
if($server === 'localhost')
$port = $set_port;
$dns = ((self::$dbtype == DBTYPE_POSTGRES) ? 'postgres' : 'mysql')
. ':host=' . $server . (is_null($port) ? '' : ';port=' . $port)
. ';dbname=' . $db;