Edit report at http://bugs.php.net/bug.php?id=49280&edit=1
ID: 49280 Updated by: [email protected] Reported by: ar at ez dot no Summary: ext/mysqlnd: Not possible to detect mysqlnd in php Status: Wont fix Type: Feature/Change Request Package: MySQLi related Operating System: * PHP Version: 5.3.0 Assigned To: mysql Block user comment: N Private report: N New Comment: Not needed, pollution. mysqli has client info, mysql has mysql_get_client_info(). With the mysql[i] extensions the info which library is used can be retrieved with a simple stristr() call using the API that is there to tell you the client [library] version [string]: *_client_info(). Even stinky PDO has a version string, although documented as int: PDO::ATTR_CLIENT_VERSION. Previous Comments: ------------------------------------------------------------------------ [2011-01-06 15:21:37] [email protected] It could still be useful and won't hurt to have it. ------------------------------------------------------------------------ [2011-01-06 14:42:49] [email protected] Original issue was "bogus" (persistent connections). Too few relevant differences between mysqlnd and libmysql otherwise and none that you can't easily detect by e.g. using mysqli->client_info. No need for an extra constant. ------------------------------------------------------------------------ [2009-08-17 17:28:58] ar at ez dot no > And you really should be checking if mysql*.allow_persistent is on or off anyway We don't need hide php warnings, so if php trows a understandable warning in such a case, then that would be sufficient. So, for my use case this is not valid anymore then, Thanks;) But as long as mysqlnd behaves differently then the old mysql client, I would vote for such a constant anyway. Or you can close with reference to the first comment(2:21) on how to detect mysqlnd if you absolutely need to know about it in code. ------------------------------------------------------------------------ [2009-08-17 17:18:45] [email protected] "p:" is allowed always since PHP 5.3.0. You only get a warning when someone has disabled persistent connections with mysqli.allow_persistent ini option. You don't need to know whether it's mysqlnd or libmysql that is used. And you really should be checking if mysql*.allow_persistent is on or off anyway. :) ------------------------------------------------------------------------ [2009-08-17 14:53:12] ar at ez dot no Hi jani! I'm not trying to workaround anything, its just that Persistent Connections are only supported on mysqli when mysqlnd is used. So it doesn't help to detect php version using PHP_VERSION, as the end user might have mysqlnd disabled / not compiled in. It is possible to detect it by by using function_exists. But since you guys might add those extra mysqlnd functions to the other mysql driver as well, that is not reliable not to mention clean. see: http://no.php.net/mysqli.mysqlnd For what I'm trying to do: eZ Publish like other php projects abstracts things, one of those is Persistent connection, witch is abstracted into a ini setting (changeable in admin gui). So I need to prepend "p:" IF user has mysqlnd, or trow a warning about unsupported setting. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=49280 -- Edit this bug report at http://bugs.php.net/bug.php?id=49280&edit=1
