Oracle 5.0 Reference Manual page 2732

Table of Contents

Advertisement

Mysqlnd user handler plugin (mysqlnd_uh)
nothing but call their
mysqlnd
to monitor mysqlnd.
See also the
How it works
Connection proxies are objects of the type MysqlndUhConnection. Connection proxy objects
are installed by mysqlnd_uh_set_connection_proxy. If you install the built-in class
MysqlndUhConnection
Example 20.332. Proxy registration, mysqlnd_uh.enable=1
<?php
mysqlnd_uh_set_connection_proxy(new MysqlndUhConnection());
$mysqli = new mysqli("localhost", "root", "", "test");
?>
The
configuration setting
PHP_INI_SYSTEM
set. If disabled, the extension will throw errors of type
Example 20.333. Proxy installation disabled
mysqlnd_uh.enable=0
<?php
mysqlnd_uh_set_connection_proxy(new MysqlndUhConnection());
$mysqli = new mysqli("localhost", "root", "", "test");
?>
The above example will output:
PHP Warning:
MysqlndUhConnection::__construct(): (Mysqlnd User Handler) The plugin has been disabled by se
PHP Warning:
mysqlnd_uh_set_connection_proxy(): (Mysqlnd User Handler) The plugin has been disabled by set
To monitor mysqlnd, you have to write your own proxy object subclassing MysqlndUhConnection.
Please, see the function reference for a the list of methods that can be subclassed. Alternatively, you
can use reflection to inspect the built-in MysqlndUhConnection.
Create a new class proxy. Derive it from the built-in class MysqlndUhConnection. Replace the
MysqlndUhConnection::connect. method. Print out the host parameter value passed to the
method. Make sure that you call the parent implementation of the
may give unexpected and undesired results, including memory leaks and crashes.
Register your proxy and open three connections using the PHP MySQL extensions mysqli,
mysql, PDO_MYSQL. If the extensions have been compiled to use the
method will be called three times, once for each connection opened.
proxy::connect
Example 20.334. Connection proxy
<?php
class proxy extends MysqlndUhConnection {
public function connect($res, $host, $user, $passwd, $db, $port, $socket, $mysql_flags) {
printf("Connection opened to '%s'\n", $host);
/* Always call the parent implementation! */
return parent::connect($res, $host, $user, $passwd, $db, $port, $socket, $mysql_flags);
counterparts. By subclassing the classes you can install your own proxy
guide to learn about the inner workings of this extension.
as a proxy, nothing happens. It behaves like a transparent proxy.
mysqlnd_uh.enable
2712
controls whether a proxy may be
E_WARNING
method. Failing to do so
connect
mysqlnd
library, the

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents