Table of Contents

PHP RFC: Remove support for libmysql from mysqli

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.

Introduction

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.

Proposal

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.

Backward Incompatible Changes

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.

Proposed PHP Version(s)

The change is proposed to go into PHP 8.2.

RFC Impact To Existing Extensions

Only mysqli extension will be affected.

Unaffected PHP Functionality

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.

Future Scope

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.

Proposed Voting Choices

Voting started on 2022-01-22 and ends on 2022-02-05.

Remove support for libmysql from mysqli
Real name Yes No
alec (alec)  
asgrim (asgrim)  
ashnazg (ashnazg)  
cmb (cmb)  
cpriest (cpriest)  
crell (crell)  
cschneid (cschneid)  
dharman (dharman)  
gasolwu (gasolwu)  
geekcom (geekcom)  
girgias (girgias)  
irker (irker)  
jbnahan (jbnahan)  
jhdxr (jhdxr)  
kalle (kalle)  
kguest (kguest)  
kocsismate (kocsismate)  
marandall (marandall)  
mauricio (mauricio)  
mbeccati (mbeccati)  
ocramius (ocramius)  
patrickallaert (patrickallaert)  
reywob (reywob)  
santiagolizardo (santiagolizardo)  
sebastian (sebastian)  
sergey (sergey)  
svpernova09 (svpernova09)  
theodorejb (theodorejb)  
tstarling (tstarling)  
twosee (twosee)  
Final result: 30 0
This poll has been closed.

Patches and Tests

https://github.com/php/php-src/pull/7889

References

Discussion on externals: https://externals.io/message/116730 Reddit thread: https://www.reddit.com/r/PHP/comments/rt6y87/drop_libmysql_support_for_mysqli/