I have done a lot of web searching and found many with this issue. I tried all the various fixes to no avail.
I'm running Uniserver on the same machine I'm using VS Studio on. I used the setup wizard to recommend the proper version of XDebug which I downloaded and installed using the recommended php.ini and launch.json documentation. The path to my webroot is c:/RSense360/USB/UniServerZ/www and this is also the folder/project I have open in VS Studio
When I launch the debugger in VS Studio with "all breakpoints" selected it properly finds and stops on the various warnings and notices in my code when I run the script via my browser. VS Code loads the appropriate script and/or include as expected and lets me view all variables etc.
Also, if I manually add a break xdebug_break(); to the script VS Code stops on it as expected.
This would tell me that most of this is configured and working properly.
The problem is when I set a breakpoint in VS Code. In the example supported by the attached logs I set a column break at line 2 of script Metromain.php. This is right after the
When I look at the debug log all the paths appear correct.
I also tried another computer with a fresh install of a different WAMP stack and php 5.6 and had the same exact problem.
Help!
Chris
PHP version: 7.1
XDebug version: 2.5.4-7.1-vc14
Adapter version: 1.11.1
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": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
XDebug php.ini config:
[xdebug]
zend_extension = C:\RSense360\USB\UniServerZcore\php71\extensions\php_xdebug-2.5.4-7.1-vc14.dll
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.idekey=default
xdebug.remote_log=${US_ROOTF}/core/php71/logs/xdebug/xdebug.log
XDebug logfile (from setting xdebug.remote_log in php.ini):
Forgot the adapter log. Here it is:
<- launchResponse
Response {
seq: 0,
type: 'response',
request_seq: 2,
command: 'launch',
success: true }
new connection 1
<- threadEvent
ThreadEvent {
seq: 0,
type: 'event',
event: 'thread',
body: { reason: 'started', threadId: 1 } }
<- initializedEvent
InitializedEvent { seq: 0, type: 'event', event: 'initialized' }
-> threadsRequest
{ command: 'threads', type: 'request', seq: 3 }
<- threadsResponse
Response {
seq: 0,
type: 'response',
request_seq: 3,
command: 'threads',
success: true,
body: { threads: [ Thread { id: 1, name: 'Request 1 (8:29:27 AM)' } ] } }
-> setBreakpointsRequest
{ command: 'setBreakpoints',
arguments:
{ source:
{ path: 'c:\RSense360\USB\UniServerZ\www\Metromain.php',
name: 'Metromain.php' },
lines: [ 2 ],
breakpoints: [ { line: 2 } ],
sourceModified: false },
type: 'request',
seq: 4 }
<- setBreakpointsResponse
Response {
seq: 0,
type: 'response',
request_seq: 4,
command: 'setBreakpoints',
success: true,
body: { breakpoints: [ { verified: true, line: 2 } ] } }
-> setFunctionBreakpointsRequest
{ command: 'setFunctionBreakpoints',
arguments: { breakpoints: [] },
type: 'request',
seq: 5 }
<- setFunctionBreakpointsResponse
Response {
seq: 0,
type: 'response',
request_seq: 5,
command: 'setFunctionBreakpoints',
success: true,
body: { breakpoints: [] } }
-> setExceptionBreakpointsRequest
{ command: 'setExceptionBreakpoints',
arguments: { filters: [] },
type: 'request',
seq: 6 }
<- setExceptionBreakpointsResponse
Response {
seq: 0,
type: 'response',
request_seq: 6,
command: 'setExceptionBreakpoints',
success: true }
-> configurationDoneRequest
{ command: 'configurationDone', type: 'request', seq: 7 }
-> threadsRequest
{ command: 'threads', type: 'request', seq: 8 }
<- threadsResponse
Response {
seq: 0,
type: 'response',
request_seq: 8,
command: 'threads',
success: true,
body: { threads: [ Thread { id: 1, name: 'Request 1 (8:29:27 AM)' } ] } }
<- configurationDoneResponse
Response {
seq: 0,
type: 'response',
request_seq: 7,
command: 'configurationDone',
success: true }
<- threadEvent
ThreadEvent {
seq: 0,
type: 'event',
event: 'thread',
body: { reason: 'exited', threadId: 1 } }
-> disconnectRequest
{ command: 'disconnect',
arguments: { restart: false },
type: 'request',
seq: 9 }
<- disconnectResponse
Response {
seq: 0,
type: 'response',
request_seq: 9,
command: 'disconnect',
success: true }
}
I have the same problem, but in my case xdebug only run on top of one file instead of the whole project.
PHP version: 7.1
XDebug version: 2.5.4
OS: Ubuntu 17.04
VSCode Version: 1.14.1

Tried upgrading VSCode to version 1.17.2, still no luck
Because a fatal error is happening?
I'm glad I'm not the only one having issues with breakpoints, I've been trying to solve this myself with no luck. I'm having the exact same issue when using PHP's built-in server on both my work/home Macs. (My log files look similar to OP, nothing out of the ordinary, file paths are good, if you need them I'll post) In my case, the breakpoints will work intermittently, and the times they don't work the grey dot turns red (unverified to verified) but never stops. I'm using the vanilla launch.json configuration. If I use xdebug_break(), the breakpoints work every time.
OSX 10.12.6
PHP 7.1.10
VScode 1.17.2 (1.17.2)
XDebug 2.5.3
DBGp 1.145
And some processes
69088 ?? 0:00.08 php /Users/eko3alpha/.vscode/extensions/felixfbecker.php-intellisense-1.5.2/vendor/felixfbecker/language-server/bin/php-language-server.php --memory-limit=-1
69094 ?? 0:06.35 /usr/local/php5-7.1.10-20171002-090111/bin/php -c /private/var/folders/ts/00j0gp4s2s55x25bxn9l7dpr0000gn/T/Ao6AvW /Users/eko3alpha/.vscode/extensions/felixfbecker.php-intellisense-1.5.2/vendor/felixfbecker/language-server/bin/php-language-server.php --memory-limit=-1
69998 ?? 0:00.21 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/base/node/stdForkStart.js /Users/eko3alpha/.vscode/extensions/felixfbecker.php-debug-1.11.1/out/phpDebug.js
69155 ttys001 0:01.23 php -S localhost:8080
netstat -an | grep 9000
tcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN
I was going to ask Felix if you could look at my original post. My issue is not the same as the one you commented on (stopping on a fatal error). My script completes normally but does not stop on VS Studio initiated breakpoints - the issue eko3alpha is also experiencing.
I will add that at one point they did start working - after I had tried dozens of things suggested by others. Unfortunately, after restarting VS Code they never worked again...
I have solved my problem.
Everything was configured properly. It was a matter of not understanding "where" to set breakpoints via VS Code.
Breakpoints must be set on a line containing a php command. I was setting generic breaks on comment lines and blank lines. The debugger will not stop on these.
Also, if a command spans several lines (my example was an echo with multiple lines for visual clarity) the breakpoint must be set on the line with the terminating semicolon. Setting it on any other line within the command will cause it to be ignored.
This is probably all common knowledge but the debugger I use for other projects/technologies does not work this way.
eko3alpha - does this also solve your problem?
Great observation @holdech!
I observed the same behavior. I had to set my breakpoints on commands. However where It differs for me is on multiline commands. If I put the breakpoint where the semicolon is, the debugger would not be triggered. I had to put it at the start of the statement. I tried this on an echo statement as well as a PDO prepared statement.
Mystery solved on my end, put the breakpoints at the beginning of statements.
I wonder if perhaps this should be added to the docs?
@eko3alpha I'm thinking the problem should be solved instead of documenting how it doesn't work properly.
I still have this issue, but i can always trigger a break by inserting some shitty code like dividing by zero. But having a hotkey to insert breaking code instead of just stopping at breakpoints is idiotic. I call them "breaking points" :D
@holdech, you response was spot on, thanks a lot for sharing this very useful nugget.
Thanks @holdech , that was the issue for me also, and I spent an inordinate amount of time trying to figure it out...
Like @eko3alpha, there is a slightly disparity between how you describe multi-line statements working and how they work for me, but either way I am glad to at least have a way to reliably break where I want to now, more or less. Agree with @brunis on a desire to see it fixed rather than just documented.
Thanks to @brunis for injecting bad code like ie echo 1/0; debugging in VS Code came alive.
But I had to add pathMapping to connect my (remote) files to the local due to Unable to open 'index.php': File not found (file:///var/www/html/web/index.php)
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"/var/www/html": "/home/clemens/Documents/projects/docker4drupal"
}
},
I was also having problems with the debugger and I could fix it by setting pathMappings and hostname.
// launch.json
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"hostname": "dev.local",
"pathMappings": {
"/var/www": "${workspaceFolder}"
}
},
If you are facing the same problem, I suggest you include "log": true in your launch.json, create a file with a single <?php phpinfo(); line and set a breakpoint there. Access the server and open the VS Code's DEBUG CONSOLE to find out the path it's sending, so you can setup the correct path.
Hi, I'm newbie on PHP Debug process.
I follow the tutorial and after Run Debug I saw the message below:
<- launchResponse
Response {
seq: 0,
type: 'response',
request_seq: 2,
command: 'launch',
success: true }
It means that debugger is working?
I don't know how to debug. I'm playing the debug button and refresh browser, but the breakpoint never reachs.
Whats wrong in my case?
My launch config json
{
"version": "0.2.0",
"configurations": [{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"log": true,
"pathMappings": {
"/var/www/html": "${workspaceRoot}",
"/app": "${workspaceRoot}/app"
},
"ignore": [
"/vendor//*.php"
]
},
]
}
Thanks
i get the same message as @marciordonez and still can not manage to hit a breakpoint.. can anybody help?
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"/": "${workspaceFolder}"
},
"log": true
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
Most helpful comment
I have solved my problem.
Everything was configured properly. It was a matter of not understanding "where" to set breakpoints via VS Code.
Breakpoints must be set on a line containing a php command. I was setting generic breaks on comment lines and blank lines. The debugger will not stop on these.
Also, if a command spans several lines (my example was an echo with multiple lines for visual clarity) the breakpoint must be set on the line with the terminating semicolon. Setting it on any other line within the command will cause it to be ignored.
This is probably all common knowledge but the debugger I use for other projects/technologies does not work this way.
eko3alpha - does this also solve your problem?