Scenario / Questions

Long story short: just installed Ubuntu 12.04 (Debian based), nginx, php-fpm and mysql. Now I need the MySQL driver for PHP, but which should I choose?

Which is better php-mysqlnd or php-mysql?

Find below all possible solutions or suggestions for the above questions..

Suggestion: 1

php-mysqlnd is the better choice. It is a drop-in replacement for the php-mysql extension. Here you can find more information about it.

Excerpt from the above-mentioned link:

The mysqlnd library is highly optimized for and tightly integrated into PHP. The MySQL Client Library cannot offer the same optimizations because it is a general-purpose client library.

The mysqlnd library is using PHP internal C infrastructure for seamless integration into PHP. In addition, it is using PHP memory management, PHP Streams (I/O abstraction) and PHP string handling routines. The use of PHP memory management by mysqlnd allows, for example, memory savings by using read-only variables (copy on write) and makes mysqlnd apply to PHP memory limits. Additional advantages include:

  • Powerful plugin API to extend feature set
  • Asynchronous, non-blocking queries
  • 150+ performance statistics
  • Powerful plugins