Guess this theme repeated here 1000 times, but I didn’t find why VSCode cannot debug PHP code.
- Latest VSCode with all required PHP extensions (PHP Debug also). Windows 11.
php --version
:
PHP 8.3.9 (cli) (built: Jul 2 2024 18:17:57) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.3.9, Copyright (c) Zend Technologies
with Zend OPcache v8.3.9, Copyright (c), by Zend Technologies
with Xdebug v3.3.2, Copyright (c) 2002-2024, by Derick Rethans
- xdebug section in php.ini is:
[xdebug]
zend_extension=xdebug
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9003
xdebug.start_with_request = yes
xdebug.discover_client_host = true
xdebug.log_level = 0
- VSCode launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
}
]
}
netstat -tan | grep 9003
:
TCP 0.0.0.0:9003 0.0.0.0:0 LISTENING InHost
TCP 127.0.0.1:57536 127.0.0.1:9003 TIME_WAIT InHost
TCP 127.0.0.1:57537 127.0.0.1:9003 TIME_WAIT InHost
TCP 127.0.0.1:57538 127.0.0.1:9003 TIME_WAIT InHost
TCP 127.0.0.1:57541 127.0.0.1:9003 TIME_WAIT InHost
TCP 127.0.0.1:57542 127.0.0.1:9003 TIME_WAIT InHost
TCP 127.0.0.1:57543 127.0.0.1:9003 TIME_WAIT InHost
TCP 127.0.0.1:57544 127.0.0.1:9003 TIME_WAIT InHost
TCP 127.0.0.1:57546 127.0.0.1:9003 TIME_WAIT InHost
TCP 127.0.0.1:57547 127.0.0.1:9003 TIME_WAIT InHost
TCP [::]:9003 [::]:0 LISTENING InHost
- Start Laravel Development Server, put debug breakpoint in right place, then open page in Firefox (with XDebug helper set in “Debug” mode) – nothing debugged, just ordinal execution.