How to enable mayfish to support mysqli database driver

Source: Internet
Author: User

Some differences between MySQL and mysqli found on the Internet:
MySQL is a non-persistent connection function, while mysqli is a permanent connection function. That is to say
MySQL opens a connection process at each link, and mysqli runs mysqli multiple times to use the same connection process, thus reducing the server overhead.

Recently, the website has been plagued by the problem of full occupation of processes due to the increase in access traffic. Therefore, to reduce the process overhead, a set of mysqli driver is added to the mayfish framework. Next, let's take a look at how to use the mysqli driver in mayfish.

Modify the MySQL settings file in the configs directory, for example, database. php.
See the following content. This is an example of using the MySQL driver by default.

CopyCode The Code is as follows: conf ('db _ host', 'localhost ');
Conf ('db _ user', 'root ');
Conf ('db _ password', '123 ');
Conf ('db _ name', 'u112741 ');
Conf ('db _ prefix', 'mfs _');
Conf ('db _ charset', 'utf8 ');

We changed itCopy codeThe Code is as follows: conf ('driver ', 'mysqli ');
Conf ('db _ host', 'localhost ');
Conf ('db _ user', 'root ');
Conf ('db _ password', '123 ');
Conf ('db _ name', 'u112741 ');
Conf ('db _ prefix', 'mfs _');
Conf ('db _ charset', 'utf8 ');

In this case, MFs will work in mysqli mode during work.

In addition, this update also adds the error log function for database query to facilitate debugging of errors. To enable this function, modify the configs/config. php file:
Conf ("logs", true); // Add and enable the error record function (default value: True)

The latest mayfish version is: http://www.jb51.net/codes/20169.html

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.