summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php22
-rw-r--r--user_guide_src/source/changelog.rst3
2 files changed, 19 insertions, 6 deletions
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index d20dcc948..95065fff9 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -106,10 +106,22 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
public function db_connect($persistent = FALSE)
{
- // Persistent connection support was added in PHP 5.3.0
- $hostname = ($persistent === TRUE && is_php('5.3'))
- ? 'p:'.$this->hostname : $this->hostname;
- $port = empty($this->port) ? NULL : $this->port;
+ // Do we have a socket path?
+ if ($this->hostname[0] === '/')
+ {
+ $hostname = NULL;
+ $port = NULL;
+ $socket = $this->hostname;
+ }
+ else
+ {
+ // Persistent connection support was added in PHP 5.3.0
+ $hostname = ($persistent === TRUE && is_php('5.3'))
+ ? 'p:'.$this->hostname : $this->hostname;
+ $port = empty($this->port) ? NULL : $this->port;
+ $socket = NULL;
+ }
+
$client_flags = ($this->compress === TRUE) ? MYSQLI_CLIENT_COMPRESS : 0;
$mysqli = mysqli_init();
@@ -118,7 +130,7 @@ class CI_DB_mysqli_driver extends CI_DB {
$mysqli->options(MYSQLI_INIT_COMMAND, 'SET SESSION sql_mode="STRICT_ALL_TABLES"');
}
- return $mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, NULL, $client_flags)
+ return $mysqli->real_connect($hostname, $this->username, $this->password, $this->database, $port, $socket, $client_flags)
? $mysqli : FALSE;
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 48ef37647..05442d803 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -198,9 +198,10 @@ Release Date: Not Released
- Improved support for the MySQLi driver, including:
- - OOP style of the PHP extension is now used, instead of the procedural aliases.
+ - OOP style usage of the PHP extension is now used, instead of the procedural aliases.
- Server version checking is now done via ``mysqli::$server_info`` instead of running an SQL query.
- Added persistent connections support for PHP >= 5.3.
+ - Added support for configuring socket pipe connections.
- Added support for ``backup()`` in :doc:`Database Utilities <database/utilities>`.
- Changed methods ``trans_begin()``, ``trans_commit()`` and ``trans_rollback()`` to use the PHP API instead of sending queries.