Documentation Home
Download this Manual
PDF (US Ltr) - 2.8Mb
PDF (A4) - 2.8Mb
HTML Download (TGZ) - 393.4Kb
HTML Download (Zip) - 405.2Kb

MySQL PHP API  /  Mysqlnd user handler plugin

Chapter 9 Mysqlnd user handler plugin

Table of Contents     [+/-]

9.1 Security considerations
9.2 Documentation note
9.3 On the name
9.4 Quickstart and Examples     [+/-]
9.5 Installing/Configuring     [+/-]
9.6 Predefined Constants
9.7 The MysqlndUhConnection class     [+/-]
9.8 The MysqlndUhPreparedStatement class     [+/-]
9.9 Mysqlnd_uh Functions     [+/-]
9.10 Change History     [+/-]

Copyright 1997-2018 the PHP Documentation Group.

The mysqlnd user handler plugin (mysqlnd_uh) allows users to set hooks for most internal calls of the MySQL native driver for PHP (mysqlnd). Mysqlnd and its plugins, including PECL/mysqlnd_uh, operate on a layer beneath the PHP MySQL extensions. A mysqlnd plugin can be considered as a proxy between the PHP MySQL extensions and the MySQL server as part of the PHP executable on the client-side. Because the plugins operates on their own layer below the PHP MySQL extensions, they can monitor and change application actions without requiring application changes. If the PHP MySQL extensions (mysqli, mysql, PDO_MYSQL) are compiled to use mysqlnd this can be used for:

  • Monitoring

    • Queries executed by any of the PHP MySQL extensions

    • Prepared statements executing by any of the PHP MySQL extensions

  • Auditing

    • Detection of database usage

    • SQL injection protection using black and white lists

  • Assorted

    • Load Balancing connections

The MySQL native driver for PHP (mysqlnd) features an internal plugin C API. C plugins, such as the mysqlnd user handler plugin, can extend the functionality of mysqlnd. PECL/mysqlnd_uh makes parts of the internal plugin C API available to the PHP user for plugin development with PHP.


The mysqlnd user handler plugin is in alpha status. Take appropriate care before using it in production environments.

User Comments
Sign Up Login You must be logged in to post a comment.