Home > Database > Mysql Tutorial > body text

让 Kohama 支持 Unix Domain Socket 方式连接到 MySQL

WBOY
Release: 2016-06-07 16:53:58
Original
1041 people have browsed it

我使用的 Kohana 版本为 2.3.1。虽然数据库配置上留有 socket 的接口,但是配置后仍然不会使用到这个 socket。只好对框架代码进行

我使用的 Kohana 版本为 2.3.1。

虽然数据库配置上留有 socket 的接口,但是配置后仍然不会使用到这个 socket。

只好对框架代码进行修改,如下(粗体部分):

system/libraries/drivers/Database/Mysql.php(mysql 驱动):

  // Build the connection info
// $host = isset($host) ? $host : $socket;
  $port = isset($port) ? ':'.$port : ”;
  // Add by Hily to support unix domain socket
  $port = isset($socket) ? ':'.$socket : $port;

system/libraries/drivers/Database/Mysqli.php(mysqli 驱动):

  // Build the connection info
// Modified by Hily
  //$host = isset($host) ? $host : $socket;

  // Make the connection and select the database
// add $socket param by Hily
  if ($this->link = new mysqli($host, $user, $pass, $database, $port, $socket))

严重怀疑 Kohana 的开发团队有没有用过 MySQL,居然犯这种低级错误。

作者:Hily 原始链接:
版权声明:可以转载,转载时务必以超链接形式标明文章原始出处和作者信息及版权声明

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!