diff --git a/include/mysqli.php b/include/mysqli.php
index 86b5a3b7fe0c6a789dfa515afae6f52ce793a76d..443a1544e9ff0b5d90b12009b2d6bb82dde71e8e 100644
--- a/include/mysqli.php
+++ b/include/mysqli.php
@@ -40,6 +40,9 @@ function db_connect($host, $user, $passwd, $options = array()) {
 
     $port = ini_get("mysqli.default_port");
     $socket = ini_get("mysqli.default_socket");
+    $persistent = stripos($host, 'p:') === 0;
+    if ($persistent)
+        $host = substr($host, 2);
     if (strpos($host, ':') !== false) {
         list($host, $portspec) = explode(':', $host);
         // PHP may not honor the port number if connecting to 'localhost'
@@ -54,6 +57,9 @@ function db_connect($host, $user, $passwd, $options = array()) {
         }
     }
 
+    if ($persistent)
+        $host = 'p:' . $host;
+
     // Connect
     $start = microtime(true);
     if (!@$__db->real_connect($host, $user, $passwd, null, $port, $socket))