At the moment both mysqli and PDO_mysql support building against mysqlnd and libmysql. The default is mysqlnd since PHP 5.4. Mysqlnd is the recommended driver to be used with PHP.
There are plenty of differences between the two drivers. Removing support for libmysql would allow PHP to simplify the code and unit tests. Advantages of mysqlnd include:
Advantages of libmysql:
However, libmysql has many disadvantages:
While many distributions offer PHP with mysqlnd as default there are some that make it confusing for new users. In particular, when using cPanel, users are confused about how to enable mysqli with mysqlnd. Instead of enabling mysqli they have to enable nd_mysqli extension which is counterintuitive.
Making it possible to build mysqli against external libraries with limited functionality is confusing and unnecessary.
The proposal is to remove the support for building mysqli against libmysql in the next version. As mysqlnd is the default option, most users should not observe any difference.
As of PHP 8.2, it will not be possible to link mysqli against any version of libmysql. If the option --with-mysqli
will be supplied, mysqli will be built with mysqlnd.
It will not be possible to build mysqli against libmysql anymore. Any functionality that was only available with libmysql will have to be added to mysqlnd as a feature request. We will not add auto-reconnect, which means that users relying on this feature will have to find other ways.
The change is proposed to go into PHP 8.2.
Only mysqli extension will be affected.
PDO_MySQL and PECL-mysql are not affected and can still be compiled against both drivers.
The PHP native driver (mysqlnd) will still be mostly compatible with libmysql and no further divergence in functionality is foreseen to happen.
This RFC does not deal with libmysql support in PDO_MySQL, although it might also be removed in future. At the moment, there are no arguments speaking against it.
Voting started on 2022-01-22 and ends on 2022-02-05.
Discussion on externals: https://externals.io/message/116730 Reddit thread: https://www.reddit.com/r/PHP/comments/rt6y87/drop_libmysql_support_for_mysqli/