Ulf Wendel

mysqlnd – MySQL native driver for PHP driver

Not long ago, Kaj announced the plan to develop a native driver for PHP. As Kaj explained, the new development will be licensed under the terms of the PHP license and donated to the PHP Group to solve any license issues.

Don’t get us wrong here. We will not break any existing PHP code or PHP applications! We want to develop another, technical superior option for PHP users to connect to MySQL. Most of the new developments will happen “under the hood” of PHP on the C level. We will write a replacement for the libmysql that can be used by PHP extension internally. We will not develop a new PHP extension, thus there will be no new API for PHP developers. You will be offered an additional, alternative option in PHP 6 to connect to the MySQL Server.

Today
PHP API “under the hood of PHP” on the C level MySQL Server
ext/mysql -> libmysql -> MySQL Server
ext/mysqli -> libmysql -> MySQL Server
PDO/MySQL -> libmysql -> MySQL Server
PHP 6
ext/mysqli -> libmysql alternatively: mysqlnd -> MySQL Server
PDO/MySQL -> libmysql alternatively: mysqlnd -> MySQL Server

The new native driver will be tightly integrated into PHP and use the existing internal PHP infrastructure: Strings, Zend Memory Management, PHP Streams (Virtual I/O), Hashes, Lists Thread Safe Resource Manager, ZLIB, SSL, Crypt, …. Using these proven and stable C modules, the new driver should become much leaner. Plus: you do not need to link against an external library (libmysql) any more and you do not need to worry about library versions any more, because the code of mysqlnd will be part of PHP.

C modules used by the libmysql vs. mysqlnd
libmysql mysqlnd
MySQL STRINGS PHP String functions
MySQL MYSYS PHP/Zend Memory Management
MySQL VIO PHP Streams
ZLIB, SSL, Crypt All are part of PHP

So, what chance did we developers have but to meet during the International PHP Conference 2006 in Frankfurt and do some brainstorming about how it could be done? The conference was an excellent opportunity to meet and interview some of the PHP brains, for example Marcus, Sara and Stefan – to name just a few. I am really thankfull that the organizer made this conference possible and we have been given the opportunity to run our meetings during the conference.

The brainstorming was not only done by MySQL employees like Georg, Andrey, Hartmut and me but Lukas and Peter also joined the meeting and gave great input. We came up with some interesting ideas. Lukas blogged already about some of them. More details will follow in future blog postings.

No final decisions have been made so far which idea we will implement and which not. We are looking for more feedback from the Community before the development starts in about one week. It would be great if you could fill out the following short survey. It won’t take you more than three minutes to answer the ten questions spreaded over three pages. Also, the questions give you hints what we are considering to implement, just in case you are curious …

If you have ideas about what should go into mysqlnd or you have any worries, never hesitate to contact Georg, Andrey or me directly. We appreciate all feedback from you that we can get.

Further blog postings about our work will follow. We will try to write one or two blog postings per week. Sometimes, we might just summarize the development work. Sometimes we might explain in more detail about the ideas and ask you again for feedback using a survey. Stay tuned and happy hacking!

Comments are closed.