• As a WP beginner, I was looking around for php debug possibilities. Up to now, I found the recommendation to define('WP_DEBUG', true); in wp-config.php. This plugin brings us a much further. We can log $variable values simply by writing trigger_error(print_r($variable, true)); We see the variable, the call stack and timestamp.
    Great.
    The only WP configuration required is installing the plugin and defining a password.
    I assume it is secure when we enter our IP address.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Fulvio Notarstefano

    (@nekojira)

    Hello Polev

    thanks for reviewing the plugin

    there are different alternatives for debugging WordPress or PHP code. Having WP_DEBUG set to true and/or using error_reporting(E_ALL); will print all PHP errors, notices and warnings alongside your html – tools like PHP Console or XDEBUG can make it a bit clearer and have a stack trace of the error (so you can track where the error was triggered and perhaps by which variable or php function. I’d recommend to have WP_DEBUG set to true and error_reporting(E_ALL) in your development environment only. You can also try plugins like Debug Bar and others that can let you benchmark database queries and such, to optimize your code.

    The IP address used by WP PHP Console restricts the usage of PHP Console by users logging in from the specified IP address or address range. This should be used only in a local developing environment (e.g. localhost), I would not recommend using it on remote/live servers and using public IPs.

    Thread Starter polev

    (@polev)

    Note that since 1.3.0 released feb 5 2015, we can write PC::debug($variable) or even PC::variable($variable) instead of trigger_error(print_r($variable, true))

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘A simple way to show PHP variables and stack trace’ is closed to new replies.