Ulf Wendel

PHP: PDO_MYSQLND for PHP preview released

Minutes ago (when writing this), we have released a first preview version of PDO_MYSQLND for PHP together with the first preview version of MySQL Connector/OpenOffice.org. Minutes ago, both new developments have been announced at the MySQL Conference.

PDO_MYSQLND announcement explained

We will explain you in more detail what both products are about during the next days. Let me start with a brief overview on PDO_MYSQLND and allow me to cite the announcement.


The first preview version of PDO_MYSQLND for PHP has been released. PDO_MYSQLND is a new driver for PDO (PHP Data Objects) which can be used to connect to the MySQL Server 4.1 and newer. PDO is a data-access abstraction layer for PHP.

You can download PDO_MYSQLND from the MySQL Forge download page at http://downloads.mysql.com/forge/pdo_mysqlnd_preview. [...] More information is available on the projects wiki page at http://forge.mysql.com/wiki/PHP_PDO_MYSQLND

From: http://lists.mysql.com/announce/525

The impact on you, the PHP/MySQL developer and user

Back in 2006/2007 the idea of a MySQL native driver for PHP was born. PHP itself is written in the C programming language. Three PHP extensions exists that can be used to connect to the MySQL server from PHP: ext/mysql, ext/mysqli and PDO_MYSQL. All three PHP MySQL extensions did use the MySQL client library (libmysql) back then.

The MySQL client library (libmysql) is a general-purpose library and not optimized for PHP. The goal was to write a drop-in replacement for libmysql which is highly optimized for PHP and tightly integrated into PHP. The impact for you:

  • Easier installation
  • Simplified maintenance
  • At least as fast libmysql – to put it carefully
  • At maximum as high memory as libmysql – typically less
  • No license issues: PHP license
  • 100% backward compatible

Meanwhile ext/mysql and ext/mysqli let you choose at compile time if you want to use libmysql or mysqlnd, mysqlnd is part of the PHP 5.3 source repository and mysqlnd is the new default for ext/mysqli in PHP 5.3. The MySQL native driver for PHP is a better deal for you. Have a look at the blog archive to read more about performance and stability, in case you have not followed the development.

Updating and/or writing a new PDO driver for MySQL which supports both libmysql and mysqlnd has been the last outstanding task. This is what PDO_MYSQLND is about: PDO_MYSQLND = PDO_MYSQL + X (mysqlnd and more!). All PHP applications that run with PDO_MYSQL will also run with PDO_MYSQLND. All functions available in PDO_MYSQL will be available in PDO_MYSQLND. You get all you had before. Plus X. As Sun/MySQL is not the maintainer of the existing PDO_MYSQL driver, we cannot take anything away from you and we do not plan to do so. You will not loose anything, you will gain a new choice.

The impact for PHP and the PDO project

PDO_MYSQLND inherits all benefits of the MySQL native driver for PHP. In addition to the shared advantages you get the first PDO driver for MySQL developed by Sun/MySQL! MySQL has always seen the PDO project as community effort. Consequently, we consider the PDO_MYSQL driver a community developed and maintained PDO driver. Whenever there was a question how to develop and maintain PDO_MYSQL we tried to answer it. But we did not actively contribute code.

What we have developed now, based on PDO_MYSQL, is a new PDO driver, which we call PDO_MYSQLND. Like back in 2007, we started the development in our own subversion repository. Like before, we offer the new development to the PHP community under the PHP license. Our goal is to make PDO_MYSQLND better than PDO_MYSQL although maintaining 100% backward compatibility through the optional use of libmysql instead of mysqlnd. Its a long way to go, as you will read below, but that is the planned road.

Quo vadis PDO_MYSQLND

The first preview version of PDO_MYSQLND is not recommended for production environments! Is has been tested on Linux only and it requires PHP 5.3. Future versions will lift these limitations. While writing these lines, Andrey asks me to start testing the very first Windows build…

The development of PDO_MYSQLND has been accomplished by developing new tests. The amount of test code has increased by about 384% . PDO_MYSQLND does pass 94.2%, PDO_MYSQL does pass 94.3% of the test suite on our x86_64 test system. This sounds good enough for a beta release. But the preview version of PDO_MYSQLND does leak memory. Nevertheless we kindly ask you to try it out on your development systems and report your findings.

  Before Today
Tests loc 4.460 17.111
Relative 100% 384%
Number of tests 64 178
Relative 100% 278%

More on the projects wiki page

For more information, including installation instructions, visit the projects wiki page at http://forge.mysql.com/wiki/PHP_PDO_MYSQLND . Credits go to the authors of PDO_MYSQL, Andrey Hristov for developing mysqlnd and tuning it for PDO and last but not least to Johannes Schlueter, the main developer of PDO_MYSQLND. Stay tuned and enjoy!

Comments are closed.