Installation on Linux
The common Unix distributions include binary versions of PHP that can be installed. Although these binary versions are typically built with support for MariaDB 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 MariaDB extensions you want to use, as well as your choice of client library for each extension.
The MariaDB Native Driver is the recommended option, as it results in improved performance and gives access to features not available when using the MariaDB Client Library. Refer to What is PHP's MariaDB Native Driver? for a brief overview of the advantages of MariaDB Native Driver.
The /path/to/mysql_config
represents the location of the mysql_config
program that comes with MariaDB Server.
Table 20.12. mysqli compile time support matrix
PHP Version | Default | Configure Options: mysqlnd | Configure Options: libmysql
| Changelog |
---|---|---|---|---|
5.0.x, 5.1.x, 5.2.x | libmysql | Not Available | --with-mysqli=/path/to/mysql_config
| |
5.3.x | libmysql | --with-mysqli=mysqlnd
| --with-mysqli=/path/to/mysql_config
| mysqlnd is now supported |
5.4.x | mysqlnd | --with-mysqli
| --with-mysqli=/path/to/mysql_config
| mysqlnd is now the default |
Note that it is possible to freely mix MariaDB extensions and client libraries. For example, it is possible to enable the MariaDB extension to use the MariaDB Client Library (libmysql), while configuring the mysqli
extension to use the MariaDB Native Driver. However, all permutations of extension and client library are possible.
The following example builds the MariaDB extension to use the MariaDB Client Library, and the mysqli
and PDO MYSQL extensions to use the MariaDB Native Driver: