vscode-php-debug: PHP Debug won't stop at breakpoint

The “stopOnEntry” option works as expected, but none of the breakpoints I set are being triggered.

PHP version: 7.0.12 XDebug version: 1.7.2 Adapter version: 1.10.0

Your launch.json:

{
	"version": "0.2.0",
	"configurations": [
		{
			"name": "Listen for XDebug - Docker",
			"type": "php",
			"request": "launch",
			"port": 9000
		},
        {
			"name": "Listen for XDebug - Web 4",
			"type": "php",
			"request": "launch",
            "serverSourceRoot": "/ebsvol/......../html",
            "localSourceRoot": "${workspaceRoot}/html",
			"port": 9000,
            "stopOnEntry": true,
            "log": true
		},
		{
			"name": "Launch currently open script",
			"type": "php",
			"request": "launch",
			"program": "${file}",
			"cwd": "${fileDirname}",
			"port": 9000
		}
	]
}

XDebug php.ini config:


zend_extension=xdebug.so

[XDebug]
xdebug.remote_enable=1
xdebug.remote_host="localhost"

Adapter logfile (from setting "log": true in launch.json):


<- 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 (12:35:42 PM)' } ] } }
-> setBreakpointsRequest
{ command: 'setBreakpoints',
  arguments: 
   { source: 
      { path: '/home/cam/Documents........./html/index.php',
        name: 'index.php' },
     lines: [ 44 ],
     breakpoints: [ { line: 44 } ],
     sourceModified: false },
  type: 'request',
  seq: 4 }
-> setBreakpointsRequest
{ command: 'setBreakpoints',
  arguments: 
   { source: 
      { path: '/home/cam/Documents/......./includes/classes/SiteLogic.php',
        name: 'SiteLogic.php' },
     lines: [ 571 ],
     breakpoints: [ { line: 571 } ],
     sourceModified: false },
  type: 'request',
  seq: 5 }
<- setBreakpointsResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 4,
  command: 'setBreakpoints',
  success: true,
  body: { breakpoints: [ { verified: true, line: 44 } ] } }
<- setBreakpointsResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 5,
  command: 'setBreakpoints',
  success: true,
  body: { breakpoints: [ { verified: true, line: 571 } ] } }
-> setFunctionBreakpointsRequest
{ command: 'setFunctionBreakpoints',
  arguments: { breakpoints: [] },
  type: 'request',
  seq: 6 }
<- setFunctionBreakpointsResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 6,
  command: 'setFunctionBreakpoints',
  success: true,
  body: { breakpoints: [] } }
-> setExceptionBreakpointsRequest
{ command: 'setExceptionBreakpoints',
  arguments: { filters: [ 'Warning', 'Exception', '*' ] },
  type: 'request',
  seq: 7 }
<- setExceptionBreakpointsResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 7,
  command: 'setExceptionBreakpoints',
  success: true }
-> configurationDoneRequest
{ command: 'configurationDone', type: 'request', seq: 8 }
<- configurationDoneResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 8,
  command: 'configurationDone',
  success: true }
<- threadEvent
ThreadEvent {
  seq: 0,
  type: 'event',
  event: 'thread',
  body: { reason: 'exited', threadId: 1 } }

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 25 (11 by maintainers)

Most upvoted comments

@diablodale Same here, it was a capitalization issue.

I ran into something similar and it was an issue with capitalization on the launch.json localSourceRoot setting. I would go ahead and put in a FQDN path to your source files (ex. “localSourceRoot”: “c:\Projects\MyProject\html”) and see if that makes a difference

It is truly a capitalization issue.

Brfore update VSCode, I used configuration like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "serverSourceRoot": "/path/to/my/project",
            "localSourceRoot": "${workspaceRoot}"
        }
    ]
}

However it shows some error message below after I update VSCode to 1.20.1

Property serverSourceRoot is deprecated, please use pathMappings to define a server root.

So I changed my configuration and it works correctly:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 2222,
            "pathMappings": {
                "/path/to/my/project":"y:\\"
            }
        }
    ]
}

But I still have a question:

Why

"localSourceRoot": "${workspaceRoot}"

wokrs fine but

"pathMappings": {
    "/path/to/my/project":"${workspaceRoot}"
}

dosen’t work ?

You are welcome to do a PR

I ran into the same behaviors and problem. And the solution was as @jasonterando wrote above. For the launch value localSourceRoot … I had to match the capitalization of my local windows path -and- and I had to lowercase the drive letter. So for a local windows path of C:\ubuntu1604\www\html invalid -> “localSourceRoot”: “C:\ubuntu1604\www\html” valid -> “localSourceRoot”: “c:\ubuntu1604\www\html”

Once capitalization was adjusted, it works very well for me.

@Ceelog the following works for me on VSCode on MacOs “pathMappings”: { “/var/www/mysite-on-my-docker-container”: “${workspaceRoot}” }

vscode version Version 1.23.1 (1.23.1) xdebug 1.12.3