Mysqlnd user handler plugin (
mysqlnd_uh
)
2710
The mysqlnd user handler plugin can be understood as a client-side proxy for all PHP MySQL
extensions (
mysqli
,
mysql
,
PDO_MYSQL
), if they are compiled to use the
mysqlnd
library. The
extensions use the
mysqlnd
library internally, at the C level, to communicate with the MySQL server.
PECL/mysqlnd_uh allows it to hook many
mysqlnd
calls. Therefore, most activities of the PHP MySQL
extensions can be monitored.
Because monitoring happens at the level of the library, at a layer below the application, it is possible to
monitor applications without changing them.
On the C level, the
mysqlnd
library is structured in modules or classes. The extension hooks almost
all methods of the
mysqlnd
internal
connection
class and exposes them through the user space
class
MysqlndUhConnection
. Some few methods of the mysqlnd internal
statement
class are
made available to the PHP user with the class
MysqlndUhPreparedStatement
. By subclassing
the classes
MysqlndUhConnection
and
MysqlndUhPreparedStatement
users get access to
mysqlnd
internal function calls.
Note
The internal
mysqlnd
function calls are not designed to be exposed to the
PHP user. Manipulating their activities may cause PHP to crash or leak
memory. Often, this is not considered a bug. Please, keep in mind that you are
accessing C library functions through PHP which are expected to take certain
actions, which you may not be able to emulate in user space. Therefore, it is
strongly recommended to always call the parent method implementation when
subclassing
MysqlndUhConnection
or
MysqlndUhPreparedStatement
.
To prevent the worst case, the extension performs some sanity checks. Please,
see also the
Mysqlnd_uh Configure Options
.
20.7.8.4.1. Setup
Copyright 1997-2012 the PHP Documentation Group. [2230]
The plugin is implemented as a PHP extension. See the
installation instructions
to install the
PECL/
mysqlnd_uh
extension. Then, load the extension into PHP and activate the plugin in the PHP
configuration file using the PHP configuration directive named
mysqlnd_uh.enable
. The below example
shows the default settings of the extension.
Example 20.329. Enabling the plugin (php.ini)
mysqlnd_uh.enable=1
mysqlnd_uh.report_wrong_types=1
20.7.8.4.2. How it works
Copyright 1997-2012 the PHP Documentation Group. [2230]
This describes the background and inner workings of the mysqlnd_uh extension.
Two classes are provided by the extension:
MysqlndUhConnection
and
MysqlndUhPreparedStatement
.
MysqlndUhConnection
lets you access almost all methods of
the
mysqlnd
internal
connection
class. The latter exposes some selected methods of the
mysqlnd
internal
statement
class. For example,
MysqlndUhConnection::connect
maps to the
mysqlnd
library C function
mysqlnd_conn__connect
.
As a mysqlnd plugin, the PECL/mysqlnd_uh extension replaces
mysqlnd
library C functions with its
own functions. Whenever a PHP MySQL extension compiled to use
mysqlnd
calls a mysqlnd function,
the functions installed by the plugin are executed instead of the original
mysqlnd
ones. For example,
mysqli_connect
invokes
mysqlnd_conn__connect
, so the connect function installed by PECL/
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...