skip to Main Content

I am not able to turn On/Off XDEBUG ‘Step Debugger’ feature reliably through ini file settings.

I understand I should be able to do so at the xdebug/php.ini files basically toggoling the value of xdebug.mode between off and debug.

This action toggles the value of xdebug.mode parameter as reported by phpinfo() and xdebug_info() pages but it does not toggle the state of the "Step Debugger" feature in neither phpinfo() or xdebug_info().

If I get it to toggle, debugging works great. But if I am not able to get to togle, through trial and error resetting the .ini files, then debugging does not work and I don’t get any errors in xdebug.log.

If I am able to toggle "Step Debugger" feature to enabled, sometimes I still can not debug and I get this error in xdebug.log:

[17414] [Step Debug] ERR: Could not connect to debugging client. Tried: 0.0.0.0:9003 (through xdebug.client_host/xdebug.client_port).

Then again, sometimes it just works!

Client Side
Windows 11
VSCODE Version 1.92.2
Remote – SSH Version v0.113.1
PHP Debug Version 1.35.0

Server Side
Ubuntu 22.04.4 LTS
XDEBUG Verion 3.3.2
Apache2 Version 2.4.52

/etc/php/8.1/fpm/conf.d/20-xdebug.ini

zend_extension=xdebug.so
xdebug.mode = off
xdebug.client_host = localhost
xdebug.connect_timeout_ms = 500
xdebug.log = "/var/log/xdebug.log"
xdebug.log_level=2

website specific php.ini

xdebug.mode = debug
xdebug.client_host = 0.0.0.0
xdebug.start_with_request = yes
xdebug.discover_client_host = yes
xdebug.log_level = 7

As you can see, I am overriding some xdebug.ini values in my website specific php.ini files. As I mentioned, these oversires are picked up by phpinfo() and xdebuf_info() functions and reported properly in their pages.

Just to clarify, enabling xdebug.mode in the 20-xdebug.ini files makes no difference.

My expectation is that whenever I change the value of xdebug.mode in the ini files it will tpggle the "Step Debugger" feature of XDEBUG extension.

Am I missing some concept or configuration detail? Thanks

2

Answers


  1. Chosen as BEST ANSWER

    Grisho4ek, thanks for your suggestion.

    It turns out the issue is not VSCODE but my Ubuntu Server and the way I was handling xdebug.ini file.

    I was setting desired xdebug parameter defaults in "/etc/php/8.1/fpm/conf.d/20-xdebug.ini setting" setting "xdebug.mode = off" and overriding "xdebug.mode = debug" later on my website specific xdebug.ini file. Doing so overrides the values of the xdebug parameters but for some reason it has NO EFFECT on Xdebug Features hence I was not able to toggle the Step Debugger.

    Not sure why xdebug parameters are overridden and features are not but so be it: it seems to work that way. I consider the issue resolved.


  2. Try to use your IPv4 address of wifi adapter/ethernet adapter as client_host. You can get IPv4 writing ipconfig in the terminal.

    $ ipconfig
    

    Set client_port=9003.
    Create launch.json for vscode.

    {
      // Use IntelliSense to learn about possible attributes.
      // Hover to view descriptions of existing attributes.
      // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
      "version": "0.2.0",
      "configurations": [
        {
          "name": "Listen for Xdebug",
          "type": "php",
          "request": "launch",
          "port": 9003,
          "pathMappings": {
            "/var/www": "${workspaceFolder}"
          }
        }
      ]
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search