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.

    Prentation 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.

    • RUBE
      #1
      RUBE commented
      Editing a comment
      Thanks a million for this post, this really really helped me out a lot and I really appreciate all your efforts on this!

    • juliduke
      #2
      juliduke commented
      Editing a comment
      I didn't understand all the idea

    • NumNum
      #3
      NumNum commented
      Editing a comment
      What are the if-blocks?

      }These?{

    • glennrocksvb
      #4
      glennrocksvb commented
      Editing a comment
      The same if-block used in enabling debug mode:
      Code:
      if (in_array($_SERVER['REMOTE_ADDR'], $ips) === TRUE) {
           //options to change
      }

    • mna
      #5
      mna commented
      Editing a comment
      Thanks, this helped me solve a problem!
    You must be logged in to post a comment.

Latest Topics

Collapse

Working...
X