ID: 49280 Updated by: j...@php.net -Summary: Not possible to detect mysqlnd in php Reported By: ar at ez dot no Status: Open -Bug Type: MySQLi related +Bug Type: Feature/Change Request Operating System: * PHP Version: 5.3.0 New Comment:
"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. :) Previous Comments: ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ [2009-08-17 14:30:15] j...@php.net So you want to circumvent a bug by adding a constant instead of fixing the actual bug? Can you please explain WHAT does not work like it should when you have enabled mysqlnd..? ------------------------------------------------------------------------ [2009-08-17 14:21:35] ar at ez dot no Seems to be possible with something like this as well: strpos( mysqli_get_client_info(), 'mysqlnd ' ) !== false But constant would still be a bit cleaner. ------------------------------------------------------------------------ [2009-08-17 14:10:00] ar at ez dot no Description: ------------ There doesn't seem to be possible to cleanly* detect that mysqlnd is currently in use. * Constant would be nice, preferably already in 5.3.next Detecting by presence off 'mysqli_fetch_all' or other functions is not exactly clean. Use case: Disabling / enabling Persistent Connections based on application specific settings. See: http://issues.ez.no/IssueView.php?Id=15315 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49280&edit=1