Skip to content
Advertisement

VSCodium (VSCode) doesn’t start debugging PHP (PHP Debug + Xdebug, Linux)

Goal
Debug with PHP Debug, Xdebug and VSCodium.

Problem

VSCode doesn’t start debugging. When I click Start Debugging the blue line under the debugging control buttons appears and moves for a few seconds and then the control buttons disappear. Same when I press the green “Run” button

phpdebugvscode1

Also on the left side, where “variables”, “watch” and “stack” are shown nothing appears.

Description
I have no experience with the VSCodium debugging options. I used a couple of tutorials (1, 2, 3, videos and tried certainly the proposal from the VSCode PHP Debug extension site (which I use). I’m using Codium (VSCode without MS) on a Linux Mint 20 machine. PHP 7.4 and Xdebug are installed via Linux Synaptic Package Manager. Of course the Xdebug helper in Firefox is enabled, breakpoints are set and I tried it in different projects. I tried a few things in the php.ini. That’s how it looks at the moment:

[XDebug]
xdebug.remote_enable = 1
; xdebug.remote_autostart = 1
; xdebug.remote_connect_back = 1

Xdebug itself is loaded via the /etc/php/7.4/cli/conf.d/20-xdebug.ini and in PhpStorm it works like expected but not in VSCodium.

That’s the standard launch.json, which is saved in the .vscode folder in the project root:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Listen for XDebug",
      "type": "php",
      "request": "launch",
      "port": 9000,
      "log": true
    },
    {
      "name": "Launch currently open script",
      "type": "php",
      "request": "launch",
      "program": "${file}",
      "cwd": "${fileDirname}",
      "port": 9000
    }
  ]
}

Here is a part of my phpinfo() output:

phpinfo1

And the xdebug part:

enter image description here

enter image description here

And here the xdebug log when i try it with VSCodium:

[5625] Log opened at 2020-10-04 10:05:20
[5625] I: Connecting to configured address/port: localhost:9000.
[5625] W: Creating socket for 'localhost:9000', poll success, but error: Operation now in progress (29).
[5625] E: Could not connect to client. :-(
[5625] Log closed at 2020-10-04 10:05:20

My guess is, that there is a basic VSCodium debugging thing, I didn’t enabled or so. But I don’t know, what it could be. Maybe somebody has an idea?

Advertisement

Answer

Finally found the solution. Its a Codium specific bug. At VSCode it works. Found the solution here: https://github.com/VSCodium/vscodium/issues/466

  1. make sure you don’t have PHP Debug extension installed;

  2. go to https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug and download vsix file using “Resources” → “Download Extension”;

  3. in VSCodium go to “Extensions” sidebar and then click three dots icon near to “Extensions” title;

  4. choose “Install from VSIX…” and select downloaded file.

@LazyOne thanks for your help again 🙂

Edit:

If you are updated to Xdebug 3.* you have to modify the xdebug section in the php.ini:

Add this:

xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9000

You could drop the last line if you change instead the port to 9003 in your launch.json.

See also this GitHub Issue

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement