PHP PDO MYSQLND
Contents |
[edit] Introduction
We are proud to announce the first alpha version of PDO_MYSQLND. The development alpha version of PDO_MYSQLND for PHP 5.3 is available for download on: http://downloads.mysql.com/forge/pdo_mysqlnd_preview.
PDO (PHP Data Objects) is a data-access abstraction layer for PHP which supports various databases through a driver interface. PDO_MYSQLND is a new mysqlnd based driver for PDO which can be used to connect to the MySQL Server 4.1 and newer. The new driver can be used as an alternative to PDO_MYSQL driver, developed and driven by the community.
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.
[edit] Advantages
PDO_MYSQLND 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.
[edit] Features and Limitations
While this alpha version of PDO_MYSQLND has been tested on different operating systems we suggest usage of Linux, full support for all platforms supported by PHP is planned for later versions. This driver supports PHP 5.3 only.
[edit] Status and target audience
The amount of test code for PDO_MYSQLND has been increased by more than 400% compared to the PDO and PDO_MYSQL tests contained in the PHP repository. In our internal testing PDO_MYSQLND does pass about 95% of the extended test suite on Linux, which is comparable to the existing PDO_MYSQL driver.
We do not recommend using this version of PDO_MYSQLND in production environments.
Nevertheless we encourage developers and enthusiasts to test it and provide feedback.
[edit] Installation
This alpha version has been tested on Linux using PHP 5.3 only.
1. Get a source distribution of PHP 5.3
- Download a source distribution of PHP 5.3 from :http://snaps.php.net/ or check out PHP from CVS. See :http://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. Add ext/pdo_mysqlnd to your PHP source tree
- Copy the new extension PDO_MYSQLND into the extension directory of your PHP source tree.
- php5> cp -R /path/to/pdo_mysqlnd-1.0.2-alpha/pdo_mysqlnd ext/pdo_mysqlnd
3. 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-mysqlnd=mysqlnd
- php5> make clean
- php5> make
- NOTE: It is not possible to build PHP with PDO_MYSQL and PDO_MYSQLND support. You cannot combine the configure options --with-pdo-mysql and --with-pdo-mysqlnd.
[edit] Known/reported Bugs
If you discovered and reported a bug in the new functionality, please add it to the list below, to avoid duplicate reports by other users:
- PDOStatement::nextRowset missing
- Native types bugs (set PDO::ATTR_STRINGIFY_FETCHES = false to workaround):
- BIT
- ZEROFILL
[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] Contact
To discuss PDO_MYSQLND, please use our PHP Forum. You may also contribute to the MySQL PHP mailing list.