Child pages
  • Guide to Standardized Hooks - Debug Mode
Skip to end of metadata
Go to start of metadata

Introduction

The Standardized Hooks System's debug mode helps to troubleshoot hook issues. Enable this mode, for example, when you experience a bug, or to test whether hooks are functional. The tool prints debug data to the /usr/local/cpanel/logs/error_log file.

Warning:

We strongly recommend that you perform these tests on development, rather than production, servers. This tool generates a large amount of error log noise.

Debug mode settings

To enable or disable debug mode for Standardized Hooks, we strongly recommend that you use the Standardized Hooks - Debug Mode option in the Development section of WHM's Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings).

This setting saves one of the following string values to the /var/cpanel/debughooks file:

Tweak Settings optiondebughooks value
Debug mode is off.0
Debug mode is on. The system displays information about a hook while it executes, but does not log debug data to the error log.log
Debug mode is on. The system displays information about a hook while it executes and logs debug data to the error log.logdata
Debug mode is on. The system displays information about every stage for every hookable event, even if no hooks exist for that stage.logall

If the system cannot locate a valid value in the /var/cpanel/debughooks file, it uses the debughooks value in the /var/cpanel/cpanel.config file as a fallback value.

  • We strongly recommend that you do not update the debughooks value in the /var/cpanel/cpanel.config file. Changes to this file do not override the values in the /var/cpanel/debughooks file.
  • The /var/cpanel/cpanel.config file uses the following debughooks settings:
    • 0 — Debug mode is off.
    • 1 — Debug mode is on. The system displays information about a hook while it executes, but does not log debug data to the error log.
    • 2 — Debug mode is on . The system displays information about a hook while it executes and logs debug data to the error log.
    • 3 — Debug mode is on. The system displays information about every stage for every hookable event, even if no hooks exist for that stage.

Note:

If you use the /var/cpanel/debughooks file to manually enable debug mode, your locale may revert to the English defaults for JavaScript elements. To fix this problem, run the following commands to disable debug mode and restart the cpsrvd daemon:

echo -n > /var/cpanel/debughooks
/scripts/restartsrv_cpsrvd

To enable or disable debug mode for Standardized Hooks, set the debughooks setting in the /var/cpanel/cpanel.config file to one of the following values:

  • 0 — Debug mode is off.
  • 1 — Debug mode is on. The system displays information about a hook while it executes, but does not log debug data to the error log.
  • 2 — Debug mode is on. The system displays information about a hook while it executes and logs debug data to the error log.

    Important:

    This setting outputs a large amount of data. 

  • 3 — Debug mode is on. The system displays information about every stage for every hookable event, even if no hooks exist for that stage.

For more information about the /var/cpanel/cpanel.config file, read our The cpanel.config File documentation for your version of cPanel & WHM.

Can't locate Module.pm in @INC

You may receive a Can't locate Module.pm in @INC warning.

This error may occur for one of the following reasons:

  • If your server runs cPanel & WHM version 11.44 and earlier, a module hook claims a syntax error, but the code passes the perl -c command, which checks the syntax of the program. This issue occurs because cPanel & WHM's internal Perl does not automatically use the same version of Perl that your system's Perl uses.
  • If your server runs cPanel & WHM version 11.46 and later, it is likely that the module is not installed to the cPanel-included Perl environment on your server. To troubleshoot this problem, run the /usr/local/cpanel/3rdparty/bin/perl -c /example/script command, where /example/script is the location of the module file.

For more information about cPanel & WHM's Perl environments, read our Guide to Perl in cPanel & WHM documentation.

For more information about the perl -c command, read the perlrun perldoc.