Ulf Wendel

PHP: Compiling mysqlnd with PHP 5.2/5.3/6.0

A user comment made clear that we need to send out a quick status update on how to install / compile mysqlnd with PHP 5.2, 5.3 and 6.0 .

mysqlnd @ PHP 5.2.x

At the time of writing PHP 5.2 is the latest production version of PHP. The latest code release is 5.2.5. The MySQL native driver for PHP (mysqlnd) is still in (late, late) beta status. As 5.2.x is the stable tree and mysqlnd is beta, mysqlnd is not part of the PHP 5.2.x code tree. To run PHP 5.2.x with mysqlnd you need to patch PHP. For example, you need to copy over zend_ptr_stack.h and zend_ptr_stack.c from the 5.3 tree. If you omit that step you’ll get some error message about the files.

However, we won’t give detailed instructions for patching PHP 5.2.x because meanwhile there is also PHP 5.3 which contains mysqlnd. And using PHP 5.3 is simpler. If you really want to patch PHP 5.2.x, you might find the blog posting PHP: mysqlnd checked in to PHP 6 (HEAD) useful.

IMHO mysqlnd should not get checked in to PHP 5.2.x . mysqlnd is just too big for a stable, production branch. mysqlnd should and does aim at PHP 5.3 and PHP 6.0, the two development branches. Therefore we focus on PHP 5.3 and PHP 6.0 and I believe its OK not to push on PHP 5.2.x patch instructions. However, if you think that is wrong: I would not reject a blog comment with detailed patch instructions.

mysqlnd @ PHP 5.3

As of October 2007, mysqlnd is part of the PHP 5.3 branch. This makes compiling PHP with mysqlnd support easy.


cvs -d :pserver:cvsread@cvs.php.net:/repository checkout -r PHP_5_3 php5  
cd php5/
./buildconf --force
./configure --help | grep -i mysql
./configure --with-mysql=mysqlnd --with-mysqli=mysqlnd
make clean; make
sapi/cli/php -m | grep -i mysql

mysqlnd @ PHP 6.0

As of July 2007, mysqlnd is part of the PHP 6.0 branch. This makes compiling PHP with mysqlnd support easy.


cvs -d :pserver:cvsread@cvs.php.net:/repository checkout php6  
cd php6/
./buildconf --force
./configure --help | grep -i mysql
./configure --with-mysql=mysqlnd --with-mysqli=mysqlnd
make clean; make
sapi/cli/php -m | grep -i mysql

Comments are closed.