Skip to content

Remote debug not working #677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
diomabros opened this issue Oct 20, 2021 · 17 comments
Closed

Remote debug not working #677

diomabros opened this issue Oct 20, 2021 · 17 comments

Comments

@diomabros
Copy link

When select "Listen for XDebug", it not wait for incoming connection but run the debugger, execute the opened PHP script and stop. Any suggestions? (Excuse me for my - bad - english!)

PHP version: 8.0.1
Xdebug version: 3.0.2
VS Code extension version: 1.21.0

Your launch.json: {
// 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": 10000,
"log": true,
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 0,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:0"
],
"program": "",
"cwd": "${workspaceRoot}",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \(http://localhost:([0-9]+)\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
}
]
}

Xdebug php.ini config:

xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.client_port = 10000
xdebug.mode = debug
xdebug.discover_client_host = 1
xdebug.start_with_request = yes
xdebug.remote_connect_back = 1

@zobo
Copy link
Contributor

zobo commented Oct 20, 2021

What are you clicking to "start" Listen for Xdebug?
F5? Menu? Green arrow on the left? Debug icon on the right? Can you attach a screenshot?

@diomabros
Copy link
Author

I tried every method that you listed below. Screenshot? Appear the Debug bar and, after the execution of the open script, close itself. In Debug console I can see the result of the script.

@zobo
Copy link
Contributor

zobo commented Oct 21, 2021

The only situation ever that the PHP script gets executed should be if the program or runtimeArgs are filled with something. In you Listen for Xdebug this is not the case. Here is how I start the listen process:
image

Can you add the "log": true part and send me the debug console contents? Here is a video showing the process: https://www.youtube.com/watch?v=aLF6j5qdnvA&t=58s

@diomabros
Copy link
Author

Log is on true. Debug console say "PHP Fatal Error: Class 'Controller' not found", but this isn't true because I use Yii framework and not be loaded if it run just opened script and not listen for incoming connections.

@zobo
Copy link
Contributor

zobo commented Oct 21, 2021

Not sure why it would start the script. Can you attach the log to your reply here?
Try to delete your launch.json and create it again.
What is the color of your VS Code bottom status bar? Blue or Purple?

@diomabros
Copy link
Author

I just deleted lanuch.json and recreated but nothing changes. When I click start button it become orange but, after the PHP error in debug console, it return blue

Before start
immagine

During script execution
immagine

After script execution
immagine

@zobo
Copy link
Contributor

zobo commented Oct 21, 2021

That looks all ok.

Can you try to switch to an older version of the plugin, specifically 1.19.0

image

image

I introduced new functionality in 1.20.0 that manipulates the debug configuration config... But I have not seen it do something like this.

Do you perhaps have some other extension that could cause this?

@diomabros
Copy link
Author

diomabros commented Oct 21, 2021

I switched to an older version of VSCode (from v1.60.0 to v1.57.1) and everything works fine now

@diomabros
Copy link
Author

diomabros commented Oct 21, 2021

I tried also what you request and the issue came back so I think there is something wrong with VSCode version 1.60.0

@zobo
Copy link
Contributor

zobo commented Oct 21, 2021

Thanks for trying this out. So if I understand correctly the combination:

  • vscode 1.60.0 + debug 1.21.0 DOES NOT WORK
  • vscode 1.57.1 + debug 1.21.0 DOES WORK?

I am currently running vscode 1.61.2

@diomabros
Copy link
Author

diomabros commented Oct 21, 2021

Exactly @zobo,

tried this combinations:

  • vscode 1.60.0 + debug 1.21.0 NOT WORK
  • vscode 1.57.1 + debug 1.21.0 WORK
  • vscode 1.60.0 + debug 1.19.0 NOT WORK
  • vscode 1.57.1 + debug 1.19.0 WORK

@lyonanderson
Copy link

I'm seeing the exact same issue. I'm running code-server:
code-server: v3.12.0
VS Code: v1.60.0

I've tried xdebug versions 1.19.0 - 1.21.0

Downgrading code-server is the only way I've found to get it work again. Let me know if you need anymore info.

@zobo
Copy link
Contributor

zobo commented Oct 21, 2021

What about 1.61.0?

@diomabros
Copy link
Author

Latest code-server version (3.12.0) has VSCode 1.60.0 so it's not possible to try with newer version

@lyonanderson
Copy link

I think it might have been reported here too: coder/code-server#4362

@zobo
Copy link
Contributor

zobo commented Oct 21, 2021

Interesting, I never tried code-server. Hopefully I'll manage to test it...

@lyonanderson
Copy link

I just tried using open code server (https://github.com/gitpod-io/openvscode-server) there are various version available. The latest ships with VSCode 1.62.0 and this works correctly with php debug 1.19.0. I tried with an earlier version VSCode 1.60.0 and it fails in the same way as above. However, VSCode 1.60.2 works fine. So perhaps it's something specific to VSCode 1.60.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants