Check if xdebug is working

后端 未结 8 2074
暗喜
暗喜 2020-12-04 16:31

Without installing a texteditor or an IDE, is it possible to test if xdebug is working, i.e. if it can debug php code?

The only part xdebug comes up in phpinfo() is

相关标签:
8条回答
  • 2020-12-04 17:10

    Run

    php -m -c
    

    in your terminal, and then look for [Zend Modules]. It should be somewhere there if it is loaded!

    NB

    If you're using Ubuntu, it may not show up here because you need to add the xdebug settings from /etc/php5/apache2/php.ini into /etc/php5/cli/php.ini. Mine are

    [xdebug]
    zend_extension = /usr/lib/php5/20121212/xdebug.so
    xdebug.remote_enable=on
    xdebug.remote_handler=dbgp
    xdebug.remote_mode=req
    xdebug.remote_host=localhost
    xdebug.remote_port=9000
    
    0 讨论(0)
  • 2020-12-04 17:15

    If you are using Eclipse then please note that while running on XDebug mode the magic constant __FILE__ will always be evaluated to:

    xdebug://debug-eval
    

    So the following check will return true if your session is under XDebug:

    $is_xdebug = false !== strpos(__FILE__,'xdebug'); // true while on XDebug
    
    0 讨论(0)
提交回复
热议问题