Skip to main content

Troubleshooting

Manual configuration of PHP extension module and whatap-php service

If installation of the PHP extension module and whatap-php service (install.sh) has not been successful, you can install them manually. Use this method when environment information cannot be checked for any reasons such as PHP compile installation.

Creation of whatap.ini

$ cp /usr/whatap/php/template.ini /usr/whatap/php/whatap.ini
$ vi /usr/whatap/php/whatap.ini

# Add this content at the top
; Enable whatap extension module
extension=whatap.so
whatap.license= # Issued access key
whatap.server.host= # Issued server IP
whatap.app_name= # Web server classification: APHP, FPHP (apache: APHP, php-fpm : FPHP)
whatap.app_process_name= # Process name of apache and php-fpm (httpd,php-fpm)
ConfigurationDescription
whatap.licenseThe access key issued from Project Menu > Management > Agent Installation can be checked.
whatap.server.hostYou can see the server IP issued from Project Menu > Management > Agent Installation.
whatap.app_nameAPHP is used for the Apache server and FPHP is used for php-fpm.
whatap.app_process_nameIf you enter the exact value as the execution process name of Apache or php-fpm, the memory usage for the process is collected. For example, they are httpd, apache2, php-fpm, and such.

Checking the PHP command (CLI)

$ which php

/usr/bin/php

Configuring the environment variables for the whatap-php service

Set the PHP CLI command's path in the $WHATAP_PHP_BIN environment variable.

$ sudo vi /etc/init.d/whatap-php

export WHATAP_PHP_BIN= # PHP command's location (/usr/bin/php)

Checking the PHP API version

Set the PHP CLI command's path in the $WHATAP_PHP_BIN environment variable.

$ sudo php -i | grep 'PHP API'

PHP API => 20100412

Checking whether PHP ZTS (Zend Thread Safe) is available

$ sudo apachectl -V | grep MPM

Server MPM: Prefork # ZTS unavailable
Server MPM: Worker # ZTS available
$ sudo php-fpm -i | grep Thread

Thread Safety => disabled # ZTS unavailable
Thread Safety => enabled # ZTS available

Checking and configuring the PHP extension module's path

Checking the PHP extension module's path

$ sudo php -i | grep extension_dir

extension_dir => /usr/lib64/php/modules => /usr/lib64/php/modules

Configuring the PHP extension module

After checking the PHP API version and PHP ZTS's availability, select a library that meets the environment. In the PHP extension module's path, copy the whatap.so file name.

  • In case PHP ZTS is available - whatap_zts_[PHP API version].so
  • In case PHP ZTS is unavailable - whatap_[PHP API version].so
    # Example in case the PHP ZTS is not supported
    $ sudo cp /usr/whatap/php/modules/x64/whatap_20100412.so /usr/lib64/php/modules/whatap.so

Configuring the environment variables for the whatap-php service

$ sudo vi /etc/init.d/whatap-php

export WHATAP_PHP_EXT_HOME= # PHP extension path (/usr/lib64/php/modules)
export WHATAP_PHP_EXT_SRC= # whatap library path and file name
# (/usr/whatap/php/modules/x64/whatap_20100412.so)]
  1. In the $WHATAP_PHP_EXT_HOME environment variable, set the PHP extension module's path.
  2. In the $WHATAP_PHP_EXT_SRC environment variable, set the whatap library's full file path.

whatap.ini configuration

  1. Check the PHP ini file's path that has been added.

    $ sudo php -i | grep '.ini files'

    Scan this dir for additional .ini files => /etc/php.d
  2. Copy whatap.ini and paste it to the path.

    $ sudo cp /usr/whatap/php/whatap.ini /etc/php.d/whtap/ini

Cannot check the PHP ini file's path that has been added

This happens if the PHP compile installation option, --with-config-file-scan-dir=PATH has not been set.

$ sudo php -i | grep '.ini files'

Scan this dir for additional .ini files => (none)

Add the content in whatap.ini at the end of php.ini.

$ php -i | grep 'php.ini'

Loaded Configuration File => /etc/php.ini

$ sudo vi php.ini

# Add at the end of a file
[whatap]
;Enable whatap extension module
extension=whatap.so
whatap.ext.error_enabled=true
whatap.ext.exception_enabled=true
whatap.trace_user_enabled=true
whatap.trace_user_using_ip=false

For other options, use /usr/whatap/php/whatap.ini.

Configuring the whatap-php service's environment variables

In the $WHATAP_CONFIG_HOME environment variable, set the path for whatap.ini.

If the added PHP's ini path cannot be checked, set the /usr/whatap/php path in which whatap.ini has been created.

$ sudo vi /etc/init.d/whatap-php

export WHATAP_CONFIG_HOME= # whatap.ini path (/etc/php.d)

Restarting the service

  • Restart Apache and PHP-FPM services.
  • Restart the whatap-php service.

Error: Not found PHP API

This occurs if the PHP command (CLI) cannot be found.

Check the correct PHP command (CLI) location and then proceed with Optional installation of the PHP extension module and whatap-php service.

Check PHP API version
$ sudo php -i | grep 'PHP API'

PHP API => 20100412

Error: Not found PHP ini directory

This error occurs when the value in Scan this dir for additional.ini files has not been checked. If the PHP compile installation option, --with-config-file-scan-dir=PATH has not been installed, the environment information does not exist.

After referring to the following guide, check the correct PHP command (CLI) location and then proceed with Optional installation of the PHP extension module and whatap-php service.

$ sudo php -i | grep '.ini files'

Scan this dir for additional .ini files => (none)

In case transactions do not appear in the response time distribution chart

The CPU and memory graphs appear but the response time distribution chart (hitmap) does not appear in the following cases:

  • The agent is connected to the collection server but the tracer is not applied to the PHP extension module.
  • Apache and PHP-FPM have not been restarted after configuration.
  1. Check whether the PHP extension module has been applied.

    $ sudo php -m

    [PHP Modules]
    bz2
    calendar
    Core
    ctype
    curl
    date

    whatap # Check the WhaTap module load

    [Zend Modules]
  2. Restart Apache and PHP-FPM services.

  3. If the PHP extension module has not been applied, it indicates abnormal installation. Check whether the path of whatap.so or whatap.ini meets the PHP environment.

    With referring to the following guide, check the items like PHP command (CLI) path, PHP extension module path, and Additional PHP ini configuration file path.

Segmentation fault, Sig bus error

If any service failure occurs after applying the PHP Monitoring, check the error log for Apache or PHP-FPM.

In the content of the error log, check for any error messages such as segmentation fault and sig bus. The messages include phrases like kill child process, exit child, and exit process.

If any error occurs, it can be seen that a conflict happened in the PHP extension module, whatap.so. Stop the PHP extension module, whatap.so, and then restart Apache or PHP-FPM.

In the environment that does not affect the service, add the Core dump setting and then reload whatap.so. If any error occurs, the dump file is generated. Analyze the dump file by using gdb for resolving the root cause.

Core dump configuration

  1. Give permission for the directory to generate the dump file.

    chmod 0777 /home/httpd-core
  2. Perform system configuration.

    ulimit -c unlimited
    sysctl fs.suid_dumpable=2
    sysctl kernel.core_uses_pid=0
    sysctl kernel.core_pattern='| /home/httpd-core/core-%e.%p'

Apache

  1. Set the CoreDumpDirectory item in the Apache conf.

    vi /etc/httpd/conf/httpd.conf

    CoreDumpDirectory /home/httpd-core
  2. Restart Apache to complete the configuration.

  3. If any error occurs, the dump file is generated. If the dump file has been generated, check the root cause of the error through gdb. Use the bt full command to check the entire stack information.

    # gdb /usr/sbin/httpd /home/httpd-core/core-httpd.31832
    ...
    ...

    > bt full

PHP-FPM

  1. In the FPM configuration file, set rlimit_core.

    rlimit_core = unlimited
  2. Restart PHP-FPM to complete the configuration.

  3. If any error occurs, the dump file is generated. If the dump file has been generated, check the root cause of the error through gdb. Use the bt full command to check the entire stack information.

    # gdb /usr/sbin/php-fpm /home/httpd-core/core-php-fpm.31832
    ...
    ...

    > bt full