Hello,
I can't get unix socket to work.
PHP version: 7.4.28
Xdebug version: 3.0.2
VS Code extension version: 1.26.1
Your launch.json:
{
"name": "Listen for Xdebug socket",
"type": "php",
"log": true,
"request": "launch",
"hostname": "unix:///tmp/xdebug.sock"
}
Xdebug php.ini config:
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.client_host=unix:///tmp/xdebug.sock
;xdebug.discover_client_host = true
xdebug.start_with_request=yes
xdebug.log=/tmp/xdebug.log
xdebug.log_level=7
Xdebug logfile (from setting xdebug.log in php.ini):
VS Code extension logfile (from setting "log": true in launch.json):
Listening on '/tmp/xdebug.sock'
<- launchResponse
Response {
seq: 0,
type: 'response',
request_seq: 2,
command: 'launch',
success: true
}
<- initializedEvent
InitializedEvent { seq: 0, type: 'event', event: 'initialized' }
-> setBreakpointsRequest
{
command: 'setBreakpoints',
arguments: {
source: { name: 'test.php', path: '/var/www/html/test.php' },
lines: [ 3, 4, 5, 6 ],
breakpoints: [ { line: 3 }, { line: 4 }, { line: 5 }, { line: 6 } ],
sourceModified: false
},
type: 'request',
seq: 3
}
<- setBreakpointsResponse
Response {
seq: 0,
type: 'response',
request_seq: 3,
command: 'setBreakpoints',
success: true,
body: {
breakpoints: [
{
verified: true,
line: 3,
source: { name: 'test.php', path: '/var/www/html/test.php' },
id: 1
},
{
verified: true,
line: 4,
source: { name: 'test.php', path: '/var/www/html/test.php' },
id: 2
},
{
verified: true,
line: 5,
source: { name: 'test.php', path: '/var/www/html/test.php' },
id: 3
},
{
verified: true,
line: 6,
source: { name: 'test.php', path: '/var/www/html/test.php' },
id: 4
}
]
}
}
-> setFunctionBreakpointsRequest
{
command: 'setFunctionBreakpoints',
arguments: { breakpoints: [] },
type: 'request',
seq: 4
}
<- setFunctionBreakpointsResponse
Response {
seq: 0,
type: 'response',
request_seq: 4,
command: 'setFunctionBreakpoints',
success: true,
body: { breakpoints: [] }
}
-> setExceptionBreakpointsRequest
{
command: 'setExceptionBreakpoints',
arguments: { filters: [] },
type: 'request',
seq: 5
}
<- setExceptionBreakpointsResponse
Response {
seq: 0,
type: 'response',
request_seq: 5,
command: 'setExceptionBreakpoints',
success: true,
body: { breakpoints: [] }
}
-> configurationDoneRequest
{ command: 'configurationDone', type: 'request', seq: 6 }
<- configurationDoneResponse
Response {
seq: 0,
type: 'response',
request_seq: 6,
command: 'configurationDone',
success: true
}
-> threadsRequest
{ command: 'threads', type: 'request', seq: 7 }
<- threadsResponse
Response {
seq: 0,
type: 'response',
request_seq: 7,
command: 'threads',
success: true,
body: { threads: [] }
}
Code snippet to reproduce:
<?php
$var = 9;
$add = 3;
$sum = $add + $var;
echo $var;
I run vs code with the configuration above on a vanilla apache2/php/debian11.
Steps to reproduce
- Before running the debugger I delete any dangling socket left from a previous attempt (
sudo rm /tmp/xdebug.sock)
- I start debugging the php script, located in
/var/www/html on Debian 11, launch.json is in /var/www/html/.vscode
a. I chown the socket created by the extension at step 2 so it can be read/write by the webserver chown 33:33 /tmp/xdebug.sock.
b. I leave the socket as it is created by the extension
- I visit http://localhost/test.php with a web browser
Vs-code should then pick up and start the debugging process but nothing happens and xdebug.log is empty and not created. It's like xdebug didn't start server-side but everything works as expected if I swap the configuration with:
{
"name": "Listen for Xdebug classic",
"type": "php",
"log": true,
"request": "launch",
"port" : 9003
}
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.discover_client_host = true
xdebug.start_with_request=yes
xdebug.log=/tmp/xdebug.log
xdebug.log_level=7
Am I forgetting something in the configuration (xdebug.ini or launch.json) or am I misunderstanding how the socket is supposed to work ?
Why do I chown the socket ?
Actually my goal is to run the debugger from the host machine with PHP behind a reverse proxy both in their own container on the same docker network isolated from the host but so far it's not working either (but at least xdebug output some log) so I am trying to get the socket right first before trying further with the docker stack.
Hello,
I can't get unix socket to work.
PHP version: 7.4.28
Xdebug version: 3.0.2
VS Code extension version: 1.26.1
Your launch.json:
Xdebug php.ini config:
Xdebug logfile (from setting
xdebug.login php.ini):VS Code extension logfile (from setting
"log": truein launch.json):Code snippet to reproduce:
I run vs code with the configuration above on a vanilla apache2/php/debian11.
Steps to reproduce
sudo rm /tmp/xdebug.sock)/var/www/htmlon Debian 11,launch.jsonis in/var/www/html/.vscodea. I chown the socket created by the extension at step 2 so it can be read/write by the webserver
chown 33:33 /tmp/xdebug.sock.b. I leave the socket as it is created by the extension
Vs-code should then pick up and start the debugging process but nothing happens and
xdebug.logis empty and not created. It's like xdebug didn't start server-side but everything works as expected if I swap the configuration with:{ "name": "Listen for Xdebug classic", "type": "php", "log": true, "request": "launch", "port" : 9003 }Am I forgetting something in the configuration (xdebug.ini or launch.json) or am I misunderstanding how the socket is supposed to work ?
Why do I chown the socket ?
Actually my goal is to run the debugger from the host machine with PHP behind a reverse proxy both in their own container on the same docker network isolated from the host but so far it's not working either (but at least xdebug output some log) so I am trying to get the socket right first before trying further with the docker stack.