PHP PDO MYSQLND
Contents |
[edit] Introduction
PDO_MYSQLND has been the working title of a patch to PDO_MYSQL the MySQL driver for PDO (PHP Data Objects). The patch allows you to compile PDO_MYSQL against the MySQL native driver for PHP (mysqlnd) or the mysqlclient library (like ever since).
The patch has been checked into the php.net CVS repository on 21.07.2008 and applied to PHP 5.3 (current development branch) and PHP 6.0 (HEAD). Consequently, you can download the latest version from https://www.php.net. Snapshots, including Windows builds, are available at https://snaps.php.net/. Check https://www.php.net/anoncvs.php for Anonymous CVS Access.
The MySQL native driver (mysqlnd) for PHP is an optimized drop-in replacement for the MySQL client library (libmysql). The MySQL native driver for PHP has proven its compatibility, stability and excellent performance as an optional backend library of the MySQL flagship PHP Connector ext/mysqli. As of PHP 5.3 all PHP extensions using MySQL (ext/mysql, ext/mysqli, PDO_MYSQL) use mysqlnd as a default.
[edit] Advantages
PDO_MYSQL inherits all benefits of the MySQL native driver for PHP:
- The development is licensed under the terms of the PHP license to prevent any license issues.
- On the C-level, mysqlnd uses many of the proven and stable PHP internal functions.
- The new backend library (mysqlnd) is contained in the PHP 5.3 source tree. There is no longer a need to link any external libraries. Thus you neither need to install the MySQL client library to compile PDO with MySQL Support nor do you need to take care of versions.
- Compiling has been made easier.
- mysqlnd handles Prepared Statements returning different numbers of result set column upon each invocation, the mysqlclient library does not offer this feature
[edit] Features and Limitations
The patch has been applied to the PHP 5.3 and PHP 6.0 CVS branches. You must use PHP 5.3 or newer. When compiling PDO_MYSQL against mysqlnd (default), you cannot connect to any MySQL Server < 4.1 . If you want to connect to MySQL < 4.1, you have to compile PDO_MYSQL against the mysqlclient library, as you did in the past. However, please note the MySQL Lifecycle Policy.
[edit] Status and target audience
The PDO_MYSQLND patch has reached beta status before it was applied to PDO_MYSQL. The patched version of PDO_MYSQL, contained in the php.net CVS repository, has solved at least the following bugs:
- pdo_mysql: stored procedure call returning single rowset blocks future queries
- PDO_MYSQL: multi-statement execution via PDO::exec() makes connection unusable
- PDOStatement->nextRowset() doesn’t work
- Add support for ATTR_FETCH_TABLE_NAMES - FEATURE IMPLEMENTED
However, PHP 5.3 has not been released yet. A first alpha version of PHP 5.3 is planned for early August 2008. Therefore, you should not yet use the patched PDO_MYSQL, that comes with PHP 5.3, in production environments.
The number of tests has been increased greatly during the development. We routinely run the tests on more than 25 different platforms to ensure quality.
[edit] Releases
- 01.08.2008 - Beta released as part of PHP 5.3 alpha1
- 21.07.2008 - Beta version checked into PHP CVS
- 08.05.2008 - 1.0.2-alpha announced
- 16.04.2008 - Preview announced
[edit] Installation
1. Get a source distribution of PHP 5.3
- Download a source distribution of PHP 5.3 from :https://snaps.php.net/ or check out PHP from CVS. See :https://php.net/anoncvs.php for Anonymous CVS Access instructions.
- > cvs -d :pserver:cvsread@cvs.php.net:/repository checkout -r PHP_5_3 php5
- > cd php5/
2. Build PHP with PDO_MYSQLND support
- Rebuild the PHP configure scripts and build PHP with PDO_MYSQLND support.
- php5> ./buildconf --force
- php5> ./configure --with-pdo-mysql=mysqlnd
- php5> make clean
- php5> make
[edit] Known/reported Bugs
Please check bugs.php.net for bugs. If you are an Open Source user, please report issues at bugs.php.net.
[edit] Community improvement requests
It would be nice to have better support for stored procedures which seems to work strange or maybe the topic on how to use them isn`t well described/documented. I`m talking about OUT/INOUT params which is hard to get/use in PHP code and multiple calls of sp in one script. After each call the db connection must be set again., Mark in response to the blog posting PHP: PDO_MYSQLND 1.0.2-alpha released
General PDO requests should be collected on the PHP project wiki. See Requests for Comments: PDO version 1 improvements.
[edit] Roadmap
PDO_MYSQL offers all planned features. We focus on maintenance and bug fixing.
[edit] Contact
To discuss PDO_MYSQLND, please use our PHP Forum. You may also contribute to the MySQL PHP mailing list.