My php.ini configuration:
[XDebug]
zend_extension = "C:xamppphpextphp_xdebug.dll"
xdebug.mode = debug
xdebug.remote_autostart = on
xdebug.profiler_enable = on
xdebug.profiler_enable_trigger = on
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="c:/xampp/tmp"
xdebug.show_local_vars=0
xdebug.remote_host = 127.0.0.1
xdebug.remote_enable = 1
xdebug.remote_port = 9003
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=1
xdebug.remote_autostart=1
xdebug.idekey=PHPSTORM
xdebug.remote_log="c:/xampp/tmp/xdebug.log"
My launch.json configuration:
{
// 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": 9003
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9003
}
]
}
but i am still getting this error in error.log:
[php:notice] [pid 9388:tid 1840] [client ::1:63322] Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost/online-store/admin/types/insert-types.php
First I used the port 9000 but it didn’t work, then I tried changing the port in php.ini and launch.json to 9003 same as the port in error log but still nothing is happening and XDebug is not working and not stopping on breakpoints.
3
Answers
I also encountered with such an error after updting my Xdebug library to 3+ version.
What I found out is that new setting
xdebug.start_with_request = yes
configures Xdebug to establish a connection on every request.Meanwhile the official doc offers to use
xdebug.start_with_request = trigger
in order to connect Xdebug only if the need for it was explicitly indicated. In this case I can start step debugging process with passing an extra key via GET parameters, for examplehttp://localhost/?XDEBUG_TRIGGER=1
, but this is inconvenient for me, all I want is press F5 within my VSCode to start debugging as I always did.So my solution is the following. I left
start_with_request = yes
and turned off most of Xdebug notifications by passingxdebug.log_level = 0
. Then i overridelog_level
withinlaunch.json
file to enable all warnings but only within debugging session.php.ini:
launch.json:
I encountered the same issue with PHP8. In my case, it was just the XDebug version suggested by their own wizard.
I use this version and it works just fine.
3.0.0-8.0-vs16
launch.json:
change pathmappings according to your requirements and the most important is hostname. after i added that, it worked