Allow Kohama to connect to MySQL through Unix Domain Socket

Source: Internet
Author: User
Tags unix domain socket kohana

The Kohana version I use is 2.3.1.

Although the socket interface is left in the database configuration, this socket is still not used after configuration.

You have to modify the Framework Code as follows (in bold ):

System/libraries/drivers/Database/Mysql. php (mysql driver ):

// 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 driver ):

// 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 ))

Seriously suspect that the Kohana development team has used MySQL and has made such a low-level error.

Author: original Hily link:Http://hily.me/blog/2009/02/kohana-mysql-unix-domain-socket/
Copyright statement: You can reprint the document. You must use a hyperlink to indicate the original source, author information, and copyright statement of the document.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.