The PHP script language features three different "extensions" to connect to the MySQL Server. The PHP term "extension" is comparable to the MySQL terms "Connector" and "Driver", please check the MySQL Reference Manual for details. The following extensions exist:
All PHP MySQL extensions are part of the source code of PHP. The source code and binaries are available from http://php.net. Both the PHP manual and the MySQL Reference Manual contain a detailed documentation of which extension to use.
The MySQL native driver for PHP is an additional, alternative way to connect from PHP 5.3 or newer to the MySQL Server 4.1 or newer. It is a replacement for the libmysql, the MySQL Client Library. As of PHP 5.3 you can use ext/mysql, ext/mysqli and PDO_MYSQL either together with libmysql as you did in the past or with mysqlnd.
We have no plans to remove libmysql support from ext/mysql, ext/mysqli or PDO_MYSQL, which would break existing applications. We just add a new, superior alternative to our PHP offerings.
The MySQL native driver for PHP (mysqlnd) is licensed under the terms of the PHP license to solve any license issues.
On the C-level mysqlnd uses many of the proven and stable PHP internal functions. All the code of the new driver is contained in the ext/mysqlnd directory of the PHP source code as of PHP 5.3. There is no need to link any external libraries. Thus you neither need to install the MySQL Client Library to compile PHP with ext/mysql, ext/mysqli and/or PDO_MYSQL support nor do you need to take care of versions. Compiling has been made easier.
The performance of some functions has been improved. We have measured considerable performance improvements, for example when fetching buffered result sets.
The current release covers the functionality of the libmysql beside some functions that are marked as experimental in the PHP documentation.
The MySQL native driver for PHP does not support the MySQL Server 4.0 or earlier. The MySQL Server 4.0 is no longer supported by MySQL as of 2008-12-31, see also MySQL Lifecycle Policy.
From the API additions discussed with Community members in November 2006 during the Frankfurt PHP conference, we managed to implement:
More additions will follow.
Q: Is mysqlnd a new PHP extension?
No, the new MySQL driver for PHP is not a new PHP extension. The driver is a replacement for the MySQL Client Library on the internal C level of the PHP extensions ext/mysql, ext/mysqli and PDO_MYSQL.
You can continue to compile the any of the above mentioned extension with the MySQL Client Library like ever since. We will not remove this functionality. Alternatively you can compile the extensions with mysqlnd. We suggest that you try it, because mysqlnd is easier to compile and we found it to be faster than the MySQL Client Library.
Q: Can other PHP extensions use it?
Yes, they can, if they want to. The source code of the new driver is the ext/mysqlnd directory of the download files. Extension writers will find that mysqlnd mimics the API of MySQL Client Library respectively the MySQL C API.
Q: Does PDO/MySQL support it?
Yes, the MySQL driver for PDO supports mysqlnd.
Q: Does it work with any MySQL Server before 4.1?
The MySQL native driver for PHP requires PHP 5.3 or PHP 6. You can use it to connect to the MySQL Server 4.1 or newer. Please note the MySQL Lifecycle Policy at http://www.mysql.com/about/legal/lifecycle/.
Q: Does it offer all functionality of the MySQL Client Library?
No, compression and SSL support are currently missing. We have started to work on compression support, SSL will come later.
Q: How can I contribute and/or report bugs?
For development discussion and reporting bugs please subscribe to the mailing list php@lists.mysql.com. See http://lists.mysql.com/ for details.
Please report bugs at http://bugs.php.net.
Q: What is next on your mysqlnd TODO?
With the delivery of mysqlnd support for PDO_MYSQL and the release of PHP 5.3, the development of the first stable release has been completed. During the next months, we will focus on optimization and performance tuning. The experimental branches, available at Launchpad, unveil some of our future ideas. However, we would be happy to learn about your needs and appreciate your feedback.
Additional experimental and unsupported branches can be found at the MySQL Launchpad web site at https://code.launchpad.net/mysql. The experimental branches contain features which might or might not go into the stable tree at any time later. Currently the following PHP related branches exist: