Announcement

Collapse
No announcement yet.

How to enable Debug Mode in vBulletin 5 for selected IP addresses only

Collapse
X
Collapse
First Prev Next Last
 

  • How to enable Debug Mode in vBulletin 5 for selected IP addresses only

    Debug mode is useful for debugging/development purposes. A vBulletin support staff has a blog about it. You can follow his instructions but if you are doing this for a live site, your users would see the detailed error messages that they are not supposed to see. Showing detailed information about the errors might reveal some delicate server information that may provide hint or lead to a potential hacker to break into your system. So instead of enabling debug mode for all users, you might want to only do it for specific IP addresses such as yours.

    To enable debug mode for your IP address, add this block of code at the bottom of both presentation and core config.php files. Don't forget to keep the default debug mode lines in the config file commented out (with // in front).

    To determine your public IP address, go to http://www.whatsmyip.org/ and it will tell your IP address. Copy that and paste into the $ips array declaration (marked with xxx.xxx.xxx.xxx) in the code below.

    Presentation config (/config.php):
    PHP Code:
    // add IPs here (include the quotes and separate with comma)
    $ips = array('xxx.xxx.xxx.xxx''xxx.xxx.xxx.xxx');
    if (
    in_array($_SERVER['REMOTE_ADDR'], $ips) === TRUE)
    {
        
    $config['debug'] = true;


    Core config (/core/includes/config.php):
    PHP Code:
    // add IPs here (include the quotes and separate with comma)
    $ips = array('xxx.xxx.xxx.xxx''xxx.xxx.xxx.xxx');
    if (
    in_array($_SERVER['REMOTE_ADDR'], $ips) === TRUE)
    {
        
    $config['Misc']['debug'] = true;


    If you suspect the error is caused by a third-party plugin installed on your site, you could turn off all plugins globally for specific IP addresses too by adding this line inside the if-block in core config.php (2nd code above):

    PHP Code:
    define("DISABLE_HOOKS"true); 

    You could practically put any available config settings inside the if-block. For example, in presentation config file, you could disable (set to false) no_template_notices setting which is enabled (true) by default. Disabling it will display PHP notices in the templates. This is useful if you are debugging a template.

    PHP Code:
    $config['no_template_notices'] = false

    To undo the above changes simply comment out the line by adding two slashes // at the start of each added lines or enclose the whole block inside /* and */. This way should you need to enable debug mode again you just have to remove those comment tags.
    Last edited by glennrocksvb; 03-21-2023, 04:11 PM.

    • glennrocksvb
      #7
      glennrocksvb commented
      Editing a comment
      Eolesen, yes but via IP address only. No user information is available in the config.

    • Eolesen
      #8
      Eolesen commented
      Editing a comment
      That's the problem -- IP address won't be predictable for my admin due to how they connect.

    • glennrocksvb
      #9
      glennrocksvb commented
      Editing a comment
      I don't have any workaround for that. Are you wanting to permanently enable debug mode for admins? This should just be temporary for debugging purposes only. If they are using VPN or other means to have dynamic IP, I recommend turning that off temporarily if you are just wanting to debug a particular problem for a specific admin.

    • Eolesen
      #10
      Eolesen commented
      Editing a comment
      I was considering it... Years ago when I was still running a lot in ColdFusion we could have the debug output turned on for specific user IDs. I've got a user group that would be utterly confused if I turned it on for everyone, so the best bad choice seems to be do it by IP and updating the config file on the fly.

    • Eolesen
      #11
      Eolesen commented
      Editing a comment
      I just came back to this after "fixing" something else....

      To update API supported currencies in the AdminCP, Wayne told me to enable Debug, which is in general a bad idea in Production....

      Instead, I swapped out the check for Debug mode with a check against the usergroupID:

      Was: if ($vb5_config['Misc']['debug'])
      Now: if(in_array(($vbulletin->userinfo['usergroupid']),array(6)))

      What I need now is someone to give me a good reason why not to do a complete search/replace in the Core directories for " $vb5_config['Misc']['debug'] " and replacing with that In_array statement and creating a Debug usergroup .....

      Talk me off the cliff, @glennrocksvb....
    You must be logged in to post a comment.

Users Viewing This Page

Collapse

There is 1 user viewing this blog topic.

  • Guest Guest

Latest Posts

Collapse

Working...
X
Searching...Please wait.
An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

Please push the back button and reload the previous window.'
An unexpected error was returned: 'Your submission could not be processed because the token has expired.

Please push the back button and reload the previous window.'
An internal error has occurred and the module cannot be displayed.
There are no results that meet this criteria.
Search Result for "|||"