diff options
author | Davey Shafik <me@daveyshafik.com> | 2020-08-11 19:23:13 +0000 |
---|---|---|
committer | Davey Shafik <me@daveyshafik.com> | 2020-08-11 19:23:13 +0000 |
commit | 68d8aa8211668ee83bbefcc377615d77c9afd474 (patch) | |
tree | 01c8bf157cb512739d8e4deefe50ad81ce64a021 /lib | |
parent | 81720edfa0a801efdcb6a8b19c014b9a7bb437f9 (diff) | |
download | php7-mysql-shim-68d8aa8211668ee83bbefcc377615d77c9afd474.zip php7-mysql-shim-68d8aa8211668ee83bbefcc377615d77c9afd474.tar.gz php7-mysql-shim-68d8aa8211668ee83bbefcc377615d77c9afd474.tar.bz2 |
Allow socket connections
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mysql.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/mysql.php b/lib/mysql.php index 215e045..a0ebb5a 100644 --- a/lib/mysql.php +++ b/lib/mysql.php @@ -54,6 +54,13 @@ namespace { $password = ini_get('mysqli.default_pw') ?: null; } + $socket = ''; + if (strpos($hostname, ':/') === 0) { + // it's a unix socket + $socket = $hostname; + $hostname = 'localhost'; + } + $hash = sha1($hostname . $username . $flags); /* persistent connections start with p: */ /* don't use a cached link for those */ @@ -95,7 +102,7 @@ namespace { $password, '', $port, - '', + $socket, $flags ); |