The common Unix distributions include binary versions of PHP that can be installed. Although these binary versions are typically built with support for MySQL extensions enabled, the extension libraries themselves may need to be installed using an additional package. Check the package manager than comes with your chosen distribution for availability.
Unless your Unix distribution comes with a binary package of
PHP with the
mysqli extension available,
you will need to build PHP from source code. Building PHP from
source allows you to specify the MySQL extensions you want to
use, as well as your choice of client library for each
The MySQL Native Driver is the recommended option, as it results in improved performance and gives access to features not available when using the MySQL Client Library. Refer to What is PHP's MySQL Native Driver? for a brief overview of the advantages of MySQL Native Driver.
/path/to/mysql_config represents the
location of the
mysql_config program that
comes with MySQL Server.
Table 3.3 mysqli compile time support matrix
|PHP Version||Default||Configure Options: mysqlnd||Configure Options: ||Changelog|
|5.0.x, 5.1.x, 5.2.x||libmysqlclient||Not Available|
|5.3.x||libmysqlclient||mysqlnd is now supported|
|5.4.x||mysqlnd||mysqlnd is now the default|
Note that it is possible to freely mix MySQL extensions and
client libraries. For example, it is possible to enable the
MySQL extension to use the MySQL Client Library
(libmysqlclient), while configuring the
mysqli extension to use the MySQL Native
Driver. However, all permutations of extension and client
library are possible.
The following example builds the MySQL extension to use the
MySQL Client Library, and the
PDO MYSQL extensions to use the MySQL Native Driver:
./configure --with-mysql=/usr/bin/mysql_config \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd [other options]
Copyright © 1997, 2014, Oracle and/or its affiliates. All rights reserved. Legal Notices