Skip to main content

Configuration

Configuration File Location

Configuration file path: /opt/tingyun-php/conf/php.conf

Application Naming

  • Automatic Naming

    auto_app_naming = 0

    Data type: integer

    0 - Disable automatic naming (default). 1 - Enable automatic naming, rule: Virtual host name (SERVER_NAME) + port (SERVER_PORT) 2 - Enable automatic naming, rule: tingyun_app_name + port (SERVER_PORT) 3 - Enable automatic naming, rule: Domain name (HTTP_HOST)

    If you deploy multiple applications on the same server, it is recommended to name by domain (HTTP_HOST) or virtual host (SERVER_NAME).

  • Application Name

    tingyun_app_name = "PHP Application"

    If you want to name the application via environment variable, write the specified environment variable into the PHP startup script, disable automatic naming (auto_app_naming = 0), and reference the environment variable name with ${}. For example: tingyun_app_name = "${PHP_APP_NAME}". Supported in PHP Agent version 3.1.1 and above.

    If the application name obtained by automatic naming does not meet your requirements, disable automatic naming by setting auto_app_naming to 0, and distinguish different applications by modifying the configuration files of Apache, php-fpm, or Nginx.

  • Apache method:

    Modify httpd.conf or .htaccess.

    Note: Requires AllowOverride Options or AllowOverride All permission.

    For each VirtualHost, add php_value tingyun_app_name "my app", for example:

    <VirtualHost 192.168.1.2>
    ServerName www.test.com
    DocumentRoot "/path/to/vhost/"
    ...
    <IfModule PHP_MODULE>
    php_value tingyun_app_name "my app name"
    </IfModule>
    </VirtualHost>

    <VirtualHost 192.168.1.3>
    ServerName www.test2.com
    DocumentRoot "/path/to/vhost2/"
    ...
    <IfModule PHP_MODULE>
    php_value tingyun_app_name "another app"
    </IfModule>
    </VirtualHost>

    Attention: The PHP_MODULE in the IfModule statement should match the name used when loading the PHP module. For example, if you use LoadModule php5_module modules/libphp5.so, the corresponding statement should be <IfModule php5_module>.

  • Nginx method:

    Modify nginx.conf, add the configuration parameter to each site, for example:

    server {
    listen 80;
    server_name www.web.com;
    location ~ /.php$ {
    fastcgi_param PHP_VALUE "tingyun_app_name=www.web.com";
    ...
    }
    }

    server {
    listen 80;
    server_name bbs.web.com;
    location ~ /.php$ {
    fastcgi_param PHP_VALUE "tingyun_app_name=bbs.web.com";
    ...
    }
    }

    Or for sites distinguished by path, for example:

    location /app1 { 
    fastcgi_param PHP_VALUE "tingyun_app_name=my app name";
    ...
    }

    location /app2{
    fastcgi_param PHP_VALUE "tingyun_app_name=another app";
    ...
    }
  • php-fpm method:

    Modify php-fpm.conf.

    [app1]
    listen=/tmp/pool-app1.sock
    php_value[tingyun_app_name] = "my app name"

    [app2]
    listen=/tmp/pool-app2.sock
    php_value[tingyun_app_name] = "another app"

Disable Agent for Specific Applications

By default, if you want to temporarily disable performance data collection for all applications, you should use the switch in the Tingyun report to temporarily disable or enable the Agent.

To disable performance data for a specific virtual host, use the following configuration.

  • Apache method:

    Modify httpd.conf or .htaccess

    Note: Requires AllowOverride Options or AllowOverride All permission.

    For the VirtualHost to be disabled, add php_flag tingyun_agent_enabled off, for example:

    <VirtualHost 192.168.1.3>
    ServerName www.test2.com
    DocumentRoot "/path/to/vhost2/"
    ...
    <IfModule PHP_MODULE>
    php_flag tingyun_agent_enabled off
    </IfModule>
    </VirtualHost>

    Attention: The PHP_MODULE in the IfModule statement should match the name used when loading the PHP module. For example, if you use LoadModule php5_module modules/libphp5.so, the corresponding statement should be <IfModule php5_module>.

  • php-fpm method:

    Modify php-fpm.conf

    [app] 
    listen=/tmp/pool-app2.sock
    php_flag[tingyun_agent_enabled] = off
  • Nginx method:

    Modify nginx.conf

    location /app1{
    fastcgi_param PHP_VALUE "tingyun_agent_enabled=false";
    ...
    }

Log Management

The PHP Agent has two modules: PHP extension and aggregator process. Each module has its own log switch.

  • PHP extension log:

    • Log level

      agent_log_level = "info"

      Values: "OFF", "CRITICAL", "ERROR", "WARNING", "INFO", "VERBOSE", "DEBUG"

      Description: This option controls the log level for writing data to the log file. "DEBUG" is the lowest level, allowing all log information to be written. "OFF" is the highest level, disabling all log output.

  • Aggregator process log:

    • Log level

      daemon_log_level = "info"

      Values: "OFF", "CRITICAL", "ERROR", "WARNING", "INFO", "VERBOSE", "DEBUG"

      Description: This option controls the log level for writing data to the log file. "DEBUG" is the lowest level, allowing all log information to be written. "OFF" is the highest level, disabling all log output.

  • Audit mode

    audit_mode = false

    Values: true / false

    Description: This option determines whether to write all data uploaded to and downloaded from the Tingyun platform to the log file.

CLI Mode Data Switch

Controls whether to collect CLI performance data:

cli_enabled = false

Values: true or false.

Description:

  • false: Do not collect CLI performance data. Default is false.
  • true: Collect CLI performance data. If set to true, CLI performance data will be displayed in the background task area.

Note: When the PHP process for CLI never exits, enabling this switch may cause performance data to accumulate and memory usage to increase.

URI Blacklist

Supported in PHP Agent 3.5.4.0 and above.

Controls whether the Agent disables data collection for certain requests to reduce data volume and bandwidth consumption.

URI matching is case-sensitive and partial matches are allowed. Multiple URIs are separated by commas.

uri_blacklist = /black1,/black2,/black3