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.

    • Eolesen
      #6
      Eolesen commented
      Editing a comment
      Could this be done limiting to a specific user? Would $vbulletin->userinfo[username] be available or is that just a step too far?

    • 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.
    You must be logged in to post a comment.

Latest Topics

Collapse

  • Eolesen
    Howdy from Trainsim.com
    by Eolesen
    I'm a new owner of a legacy 4.2.5 forum hosted at Trainsim.com , and totally drinking from a firehose on vBulletin and its quirks.

    Hoping...
    03-21-2023, 09:31 AM
  • alex
    hello from France
    by alex
    Hello,

    Thanks for welcoming me on the vbmods.rocks website, I have a vb forum since many years (2007).

    I left the administration...
    03-19-2023, 05:51 AM
  • RSA
    Hello
    by RSA
    Hello, my name is Ronny and I come from Germany. I have vbulletin v5.6.9


    I'm trying to get used to it and I hope to find some tips...
    03-17-2023, 11:28 AM
  • lemonis44
    hello from Greece
    by lemonis44
    Hello
    I am from GREECE
    I'm glad he joined your community
    I hope and wish we have a good time​
    03-14-2023, 06:36 PM
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 "|||"