PHP Database sensors

The section provides information about following a group of sensors used for database instrumentation:

  • PHP MySQL Sensor (it covers MySQL and MySQLi interfaces for both MySQL and MariaDB databases, for both procedural and object oriented calls)
  • PHP Oracle Sensor
  • PHP PDO Sensor
  • PHP PostgreSQL Sensor

Each of these sensors enables you to see how the connection to the database is established and captures SQL queries issued by PHP for different database interfaces.

Sensor configuration

Perform the following steps to enable monitoring of PHP database queries:

  1. Start the AppMon Client.
  2. Open the System Profile Preferences dialog box for your application.
  3. Enable PHP monitoring. To do this, navigate to General settings for your application, and select the PHP check box in the Technology section.
  4. Click Apply to save the configuration.
  5. Enable monitoring of database queries.
    1. Go to Sensor Placement section for your Agent Group.
    2. In the Sensor Placement table, find required PHP Database (MySQL, PostgreSQL, PDO, or Oracle) sensor and select the check box in the Place column.
  6. Optionally modify the default length of captured SQL commands. To do this, open the System Profile Preferences dialog box and select Agent Group/tier with PHP technology > Sensor Configuration and then select the required PHP database sensor in the Sensor Configuration list. Change the maximum number of characters if needed. Click OK to save the settings.


Maximum SQL capture length: Limits the captured SQL statements to the specified length. All symbols, exceeding the limit, are cut. Default value is 512.

Captured information

The PHP agent instruments database actions as follows:

All MySQL functions set API to Database.

Function Description
mysql_query Captures the query.
mysql_unbuffered_query Captures the query.
mysql_db_query Captures the query and reports database name as an argument.
mysql_connect Reports all arguments.
When a password is used as an argument it is always masked with * (asterisk) characters.
mysql_close Processes the query, but does not present it as node within a PurePath.

See PHP documentation for an explanation of MySQL functions.