Building MySQL Native Driver(Mysqlnd) for PHP by phpize

After building PHP with PHP-FPM for Nginx server and building MySQL server. This document shows you how to build Mysqlnd(MySQL Native Driver) .

Mysqlnd is written in C as a PHP extension, so it is unlike the older MySQL client library that was written by MySQL AB(Oracle Corporation) under MySQL license, it is released under the PHP license.

Using Mysqlnd you don’t need to copy the MySQL client library, so this much more convenient for web server without MySQL server.

Using MySQL Native Driver leads to better performance than using MySQL Client, especially when it comes to memory usage, as a PHP extension, the driver uses the PHP memory management, so it is supports the PHP memory limit. Using the MySQL Client Library, each row is stored in memory twice, whereas with the Mysqlnd each row is only stored once in memory.

1. Adjust the PATH environment variable to include the path to the phpize

2. Install
If you php is built from source codes you will find ext/mysqlnd in your php sources codes

3. Fix errors

3.1 Cannot find autoconf.

3.2 configure: error: Cannot find OpenSSL’s <evp.h>
I tried all the solutions I found from google, none of them are working.

4. Edit /usr/local/php5/lib/php.ini

 

5. Restart php-fpm

Rebuilding PHP

Actually I didn’t fix the error 3.2 “configure: error: Cannot find OpenSSL’s”. But I do install Mysqlnd by rebuilding PHP with following configure parameters:

The other steps please check Building PHP with PHP-FPM for Nginx from Sources on Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *