Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Jingsheng Wang
    @skyred
    Not sure what has changed, but today, I cannot toggle breakpoints anymore. For the existing breakpoints that I created, double click or F9 can remove them, but I cannot add more.
    Never mind, found the issue
    Franco Bianconi
    @fbianconi
    Im unable to get php-debug in listening state. when I launch the server says It can't connect to debugging client (this is xdebug v3)
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "log": true
        },
    php -d xdebug.mode=debug artisan serve 
    The vscode side doesn't print any message that I can find, looked for it in debug console, output, in terminal.. nothing, The debug controls flash for a bit and disappear and nothing else happens. Any ideas?
    Xdebug: [Step Debug] Could not connect to debugging client. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(
    Lovor01
    @Lovor01
    @fbianconi can you check with phpinfo() that xdebug is installed and it works OK?
    Lovor01
    @Lovor01

    @fbianconi is it configured correctly in php.ini?
    In my case:
    zend_extension = php_xdebug-3.0.1-7.4-vc15-nts-x86_64.dll

    ; XDEBUG Extension
    [xdebug]
    xdebug.mode=debug
    xdebug.start_with_request=yes

    Franco Bianconi
    @fbianconi
    Xdebug extension was working just fine. I switched to a fork of this extension (tiansin/vscode-php-debug) that claimed to work with Xdebug 3 and everything just worked. Thanks.
    Jan Dittrich
    @jan-di
    Hey guys, I am struggling to filter caught exceptions so that they don't break the script. I have a simple testscript below. If I have have Everything checked, it shows one break per exception + one break for the fatal error (because there is an uncaught exception). If I only check the Error nothing is shown, even the fatal error (that is shown when Everything is checked..). Is there way to break only on uncaught exceptions, and ignore caught ones?
    grafik.png
    Abo
    @AndreaBorgia-Abo
    hello. new user here, trying to setup the extension to work on a Debian/Testing system
    what works: xdebug is now shown phpinfo
    what does not work: breakpoint, for example in a simple for loop
    for ($i = 1; $i <= 10; $i++) {
    echo $i;
    }
    when I set the breakpoint then click "run, start debugging" a new firefox instance opens as expected but I get all the numbers in one go
    what should I check in particular?
    Abo
    @AndreaBorgia-Abo
    hmm, log says cannot connect to localhost 9000 ...
    Abo
    @AndreaBorgia-Abo
    i don't understand: vscode configuration has two modes, "listen for xdebug" and "launch", but then the supported settings only mention "launch".
    ok, if I disregard that bit it seems to work.... still, it's a bit confusing.
    Abo
    @AndreaBorgia-Abo
    (this was another fine example of rubber duck debugging...)
    Abo
    @AndreaBorgia-Abo
    another source of confusion was reading this page at about the same time: https://github.com/firefox-devtools/vscode-firefox-debug
    MCrowson
    @mcrowson

    Good morning all. I'm having some trouble I was hoping you could help with.

    When I run the listen for xdebug launch configuration, the bar at the bottom never turns from blue to orange, and the listener process dies almost instantly. I've tried hunting around for logs within vscode but can't seem to find anywhere that describes why the listener process is dying. Any ides on where to look for logs?

             {
                "name": "Listen for XDebug",
                "type": "php",
                "request": "launch",
                "port": 9005,
                "log": true,
                "pathMappings": {
                    "/var/www/cloud": "${workspaceRoot}"
                }
            },
    And I am on Fedora 33
    Lovor01
    @Lovor01
    Why is port 9005, did you change it also in XDebug to be 9005?
    And you have "launch" request, which is for CLI debugging. Do you debug CLI or web page?
    MCrowson
    @mcrowson
    yes it is also 9005. It is a web page
    what should my request be?
    MCrowson
    @mcrowson
    Issue turned out to be some local config change I'd made. Factory reset of codium got it working
    lyhqxgb
    @lyhqxgb

    Hello, everyone. I'm using docker and wsl2 to run my web server. I met trouble in configuring xdebug. It seems that my php-fpm could not connect to my vscode, however, my vscode is listening port correctly. Here's my php.ini set

    [XDebug]
    xdebug.remote_enable = 1
    xdebug.remote_autostart = 1
    ;xdebug.remote_handler = "dbgp"
    ; Set to host.docker.internal on Mac and Windows, otherwise, set to host real ip
    xdebug.remote_host = host.docker.internal
    ;xdebug.remote_port = 9000
    xdebug.remote_log = /var/log/php/xdebug.log

    And here's my vscode set

    {
                "name": "Listen for XDebug",
                "type": "php",
                "request": "launch",
                "port": 9000,
                "pathMappings": {
                    "/www/tp": "/home/leo/dnmp/www/tp",
                },
                "log":true
            }

    My vscode is open wsl2 folder and I think it's running in wsl2. I guss that I send request from browser in windows, and windows received xdebug's request but it didn't trans it to wsl2. Can anybody help? Thanks very much.

    lyhqxgb
    @lyhqxgb

    Hi, everybody. I've solved my problem. I set windows to let it trans request to wsl2 and it worked! Here's my setting

    netsh interface portproxy add v4tov4 listenaddress=192.168.1.105 listenport=9001 connectaddress=172.27.144.1 connectport=9001

    Here's the solution I've found. Thanks for your attention!

    Mark Abel
    @abelmark
    I'm having an issue connecting this to a docker container... It seems to be listening correctly as when I run my code when it hits the block I put a breakpoint on i get a message "command not found" and an error
    XDebugError: command is not available
        at new Response (/Users/maabel/.vscode/extensions/felixfbecker.php-debug-1.14.5/out/xdebugConnection.js:58:19)
        at Connection.<anonymous> (/Users/maabel/.vscode/extensions/felixfbecker.php-debug-1.14.5/out/xdebugConnection.js:613:20)
        at Generator.next (<anonymous>)
        at fulfilled (/Users/maabel/.vscode/extensions/felixfbecker.php-debug-1.14.5/out/xdebugConnection.js:5:58)
        at processTicksAndRejections (internal/process/task_queues.js:94:5) {
      code: 5,
      name: 'XDebugError'
    }

    Has anyone encountered this?

    Launch.json

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "docker.drupal.com",
                "type": "php",
                "request": "launch",
                "port": 9000,
                "pathMappings": {
                    "/etc/drupal/sites_d7": "${workspaceRoot}/sites_d7"
                }
            },
            {
                "name": "Launch currently open script",
                "type": "php",
                "request": "launch",
                "program": "${file}",
                "cwd": "${fileDirname}",
                "port": 9000,
            },
        ]
    }
    Mark Abel
    @abelmark
    php.ini
    ; Xdebug\n\
        zend_extension="/usr/lib64/php/modules/xdebug.so"\n\
        xdebug.remote_enable=1\n\
        xdebug.remote_autostart=1\n\
        ;xdebug.remote_connect_back=1\n\
        xdebug.remote_host=docker.for.mac.localhost\n\
        xdebug.remote_port=9000\n\
        xdebug.idekey="phpstorm"
    Philipp
    @p6gb_gitlab

    I followed the install instructions but XDebug does not show in phpinfo() output. I am running PHP 7.4.9 on a local MAMP server. Here's what I added to php.ini(the one from my MAMP installation):

    [xdebug]
    zend_extension = /Applications/MAMP/bin/php/php7.4.9/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so
    xdebug.mode = debug
    xdebug.start_with_request = yes
    xdebug.client_port = 9000

    Does anyone have an idea what the problem might be?

    Philipp
    @p6gb_gitlab
    Solved. I installed XDebug using phpize from the wrong PHP version. I didn't know MAMP came with XDebug preinstalled and it only has to be activated in php.ini.
    tertek
    @tertek

    Hello everyone,
    I am using XDebug on Windows with this config:

    xdebug.mode=debug,develop,profile
    xdebug.start_with_request=yes
    zend_extension="C:\xampp\php\ext\php_xdebug.dll"
    xdebug.output_dir="C:\xampp\tmp\profiler_logs"
    xdebug.client_port=9000

    I am getting these notices when I open the page on localhost and Debugging is not running inside VS Code:

    [Tue Jan 26 13:18:30.483045 2021] [php7:notice] [pid 18028:tid 1904] [client 127.0.0.1:61016] Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9000 (through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost/redcap/index.php?action=myprojects
    [Tue Jan 26 13:18:31.186401 2021] [php7:notice] [pid 18028:tid 1904] [client 127.0.0.1:61016] Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9000 (through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost/redcap/index.php?action=myprojects
    [Tue Jan 26 13:18:31.587947 2021] [php7:notice] [pid 18028:tid 1904] [client 127.0.0.1:61016] Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9000 (through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost/redcap/index.php?action=myprojects
    [Tue Jan 26 13:18:31.991893 2021] [php7:notice] [pid 18028:tid 1904] [client 127.0.0.1:61016] Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9000 (through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost/redcap/index.php?action=myprojects
    [Tue Jan 26 13:18:32.399141 2021] [php7:notice] [pid 18028:tid 1904] [client 127.0.0.1:61016] Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9000 (through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost/redcap/index.php?action=myprojects
    [Tue Jan 26 13:18:32.802313 2021] [php7:notice] [pid 18028:tid 1904] [client 127.0.0.1:61016] Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9000 (through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost/redcap/index.php?action=myprojects

    The notice only disappears if I disable debugging in the config. Disabling xdebug.start_with_request did not help as suggested here. Also disabling the Firefox Addon did not help.

    Randall Hedglin
    @randallhedglin

    Hello,

    I've been struggling for a few days now to get PHP Debug working with VS Code. First some explanation on my setup: I have a MacBook running Parallels with Windows 10 and Ubuntu. I need to develop on all three systems, and it took some tweaking, but they all work perfectly using a shared folder ("WebServer") on the Mac side. It's mapped to Windows as drive V:, and I'm trying to get VS Code in Widows to perform PHP debugging but have been unsuccessful. I've gotten the connection working, upgraded to xDebug 3, and tried numerous other things but finally narrowed it down to a mismatch between filenames being used by xDebug and by VS Code.

    So, here was my original launch.json:

    {
        "name": "Listen for Xdebug",
        "type": "php",
        "request": "launch",
        "port": 9003
    }

    which results in the following xDebug log output:

    [11092] [Step Debug] DEBUG: Checking whether to break on v:\index.php:6.
    [11092] [Step Debug] DEBUG: I: Current location: \\MAC\WEBSERVER\index.php:6.
    [11092] [Step Debug] DEBUG: I: Matching breakpoint 'v:\index.php:6' against location '\\MAC\WEBSERVER\index.php:6'.
    [11092] [Step Debug] DEBUG: R: File name length (25) doesn't match with breakpoint (12).

    So there is a mismatch between what xDebug wants and what VS Code wants (the mapped drive v: versus the network path //MAC/WEBSERVER). Then I discovered pathMappings and with some more tweaking got to this:

    {
        "name": "Listen for Xdebug",
        "type": "php",
        "request": "launch",
        "port": 9003,
        "pathMappings": {
            "//MAC/WEBSERVER": "v:"
        }
    }

    which is successful in the xDebug log:

    [11092] [Step Debug] DEBUG: Checking whether to break on \\MAC\WEBSERVER\index.php:6.
    [11092] [Step Debug] DEBUG: I: Current location: \\MAC\WEBSERVER\index.php:6.
    [11092] [Step Debug] DEBUG: I: Matching breakpoint '\\MAC\WEBSERVER\index.php:6' against location '\\MAC\WEBSERVER\index.php:6'.
    [11092] [Step Debug] DEBUG: F: File names match (\\MAC\WEBSERVER\index.php).

    but in VS Code, I get an error dialog:

    Unable to open 'index.php': Unable to read file '\WEBSERVER\index.php'
    (Error: Unable to resolve non-existing file '\WEBSERVER\index.php').

    So what I can't figure out is why VS Code is dropping the '//MAC' part of the file path and causing an error. Should I be using pathMappings differently, or is there something else I'm missing? Thanks!

    Randall Hedglin
    @randallhedglin

    Hi all, I've finally got this working and wanted to share my solution in case it helps anyone else. It turns out I had a couple of things going on:

    The first has to do with pathMappings. I couldn't find much in the way of documentation, but after considerable trial and error, I found the working configuration (posted below).

    The second thing has to do with WAMP Server, which is what I'm using on the Windows side. I have since learned that WAMP Server has a separate php.ini for internal operations (not the one that opens when you edit php.ini from the taskbar icon). Opening php.ini from the taskbar opens a file called php.ini, but that file is apparently just a temp file created from another file called phpForApache.ini. Changes are saved back to phpForApache.ini, and the temp file is eventually deleted. (On my system, this file is located at C:\wamp64\bin\php\php7.4.0\phpForApache.ini.)

    So part of my problem was that VS Code actually runs PHP on the internal php.ini (the actual php.ini, on my system C:\wamp64\bin\php\php7.4.0\php.ini), not phpForApache.ini (which WAMP Server again masks as php.ini when you edit settings from the taskbar icon). The internal php.ini file has a big warning at the top: ****** DO NOT EDIT THIS FILE **** DO NOT EDIT THIS FILE ******, which I ignored, added my xDebug config there, and finally VS Code could run xDebug properly in both "Launch currently open script" and "Listen for Xdebug" modes.

    To wrap up, here is my final working xDebug configuration (which again had to be copied into BOTH php.ini and phpForApache.ini):

    [xdebug]
    zend_extension="c:/wamp64/bin/php/php7.4.0/zend_ext/php_xdebug-3.0.3-7.4-vc15-x86_64.dll"
    xdebug.mode = debug
    xdebug.start_with_request = yes
    xdebug.client_host = localhost
    xdebug.client_port = 9003
    xdebug.discover_client_host = true
    xdebug.connect_timeout_ms = 3000
    xdebug.idekey = VSCODE
    xdebug.log = "//Mac/WebServer/.xdebug.log"
    xdebug.log_level = 7
    xdebug.file_link_format = vscode://file/%f:%l
    xdebug.filename_format = %f

    And here is my working launch.json for both configurations:

    {
        // 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": {
                    "//MAC/WEBSERVER": "v:",
                    "/WEBSERVER": "v:"
                }
            },
            {
                "name": "Launch currently open script",
                "type": "php",
                "request": "launch",
                "program": "${file}",
                "cwd": "${fileDirname}",
                "port": 9003,
                "pathMappings": {
                    "v:": "//MAC/WEBSERVER",
                    "/MAC/WEBSERVER": "v:"
                },
                "runtimeExecutable": "C:\\wamp64\\bin\\php\\php7.4.0\\php.exe"
            }
        ]
    }

    Hope it helps someone!

    Jingsheng Wang
    @skyred
    Is there a recent change to make xdebug client only listen to 127.0.0.1:9003? I am guessing previously the port was open on 0.0.0.0:9003
    Jingsheng Wang
    @skyred
    Filed an issue here xdebug/vscode-php-debug#601
    Tome
    @tomwjerry

    Hello, I have stumbled upon a rather hard-to-resolve issue about VS Code + WSL2 + Docker. Breakpoints or error wont hit VS Code but I doesn't get any errors.

    My php config:

    FROM php:fpm
    RUN pecl install xdebug \
        && docker-php-ext-enable xdebug
    RUN echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/xdebug.ini \
        && echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/xdebug.ini \
        && echo "xdebug.discover_client_host=true" >> /usr/local/etc/php/conf.d/xdebug.ini \
        && echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/xdebug.ini

    VS Code config:

    {
                "name": "Listen for Xdebug",
                "type": "php",
                "request": "launch",
                "port": 9003,
                "log": true,
                "hostname": "localhost",
                "externalConsole": false,
                "xdebugSettings": {
                    "max_data": 65535,
                    "show_hidden": 1,
                    "max_children": 100,
                    "max_depth": 5
                },
                "pathMappings": {
                    "/srv": "${workspaceFolder}"
                }
            }
    Tome
    @tomwjerry

    VS code seems to connect (I am running WSL mode towards an ubuntu 20.04 image) to the docker php containers xdebug thing, if it didn't I would get an error. But I get no errors so it is super strange.

    xd(2) <- run -i 15
    xd(2) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="15" status="stopping" reason="ok"></response>
    xd(2) <- stop -i 16
    xd(2) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stop" transaction_id="16" status="stopped" reason="ok"></response>
    <- threadEvent
    ThreadEvent {
      seq: 0,
      type: 'event',
      event: 'thread',
      body: { reason: 'exited', threadId: 2 }
    }
    
    -> threadsRequest
    { command: 'threads', type: 'request', seq: 10 }
    
    <- threadsResponse
    Response {
      seq: 0,
      type: 'response',
      request_seq: 10,
      command: 'threads',
      success: true,
      body: { threads: [] }
    }

    In the debug console, seems normal. As if debugger continues without stopping.

    Tome
    @tomwjerry
    Okay guys, I foobar'd. It was pathMappings set to wrong folder! Strange, because I didn't get any errors!
    Quentin “Storm1er” Decaunes
    @le.storm1er_gitlab

    Hi guys,

    I'm struggling debugging, it was working a few days ago...

    Win10
    WSL
    Vscode with remote wsl extension (running in an ubuntu)
    Docker Desktop

    xdebug.ini

    xdebug.remote_enable=1
    xdebug.remote_autostart=1
    xdebug.remote_port=9001
    xdebug.remote_host=172.19.44.44 < This is ubuntu wsl IP
    xdebug.remote_mode=req
    xdebug.remote_log=/var/www/xdebug.log

    launch.json

    {
        // Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
        // Pointez pour afficher la description des attributs existants.
        // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Listen for Xdebug WSL",
                "type": "php",
                "request": "launch",
                "port": 9001,
                "log": true,
                "hostname": "0.0.0.0",
                "stopOnEntry": false,
                "pathMappings": {
                    "/var/www": "${workspaceRoot}"
                }
            }
        ]
    }
    and log:
    tail -f xdebug.log
    Log opened at 2021-09-20 09:29:15
    I: Connecting to configured address/port: 172.19.44.44:9002.
    E: Time-out connecting to client. :-(
    Log closed at 2021-09-20 09:29:15
    Tome
    @tomwjerry
    Looks like it connects to port 9002
    You check in docker console what config php xdebug actually use
    It tends to live its own life