I want to use VSCode's 'PHP Debug' plugin with Xdebug to debug PHP scripts.
But when I choose "Debug|Start Debugging F5" the little debug pop-up appears and I am stuck. Buttons for Pause, Restart, Stop are active. Buttons for Step over, into, out are inactive (greyed out). Nothing happens in the debug console.
(1) VSCode 1.42.1 is installed
(2) XAMPP v3.2.4 is up and running
(3) Xdebug is installed using the wizzard and pasting my phpinfo() data to determine the correct version. When I start 'admin' from XAMPP Control Panel and review phpinfo, the browser shows me (amongst many other things):
[...]
This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Xdebug v2.9.2, Copyright (c) 2002-2020, by Derick Rethans
[...]
(4) php.ini
has
[XDEBUG]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.show_local_vars = 1
xdebug.remote_log = "C:\Program Files_\xampp\php\logs\xdebug.log"
zend_extension = "php_xdebug-2.9.2-7.4-vc15-x86_64.dll"
(please note that "Program Files_" is NOT the protected "Program Files" directory, XAMPP has write access as shown for point (9) below)
(5) the Windows path has C:\Program Files_\xampp\php;
in it
(6) when I use Code Runner extension in VSCode to run a "Hello World.php" script is runs just fine
(7) launch.json
for the VSCode debugger has
"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,
}
]
(8) my Windows firewall has an inbound rule to allow TCP traffic on port 9000.
(9) when I just run the code, xdebug.log (see php.ini
) is updated with
[94396] Log opened at 2020-03-08 07:45:28
[94396] I: Connecting to configured address/port: localhost:9000.
[94396] E: Time-out connecting to client (Waited: 200 ms). :-(
[94396] Log closed at 2020-03-08 07:45:28
But when I use "Debug|Start Debugging F5" nothing happens in xdebug.log.
That is all the information that I thought relevant so far. Which leaves me like so:
me -> update_status("at wit's end")
Do you wizards out there have any idea where to dig? Which config file to tweak? Which log file to consult?
footnote: debugging of Python scripts in VSCode works just as expected.
netstat
or some another tool (e.g. the one with GUI). Accordingly to the log Xdebug is unable to connect to Xdebug TCP 9000 port that VSCode should be listening. Maybe it does not listen?launch.json
is for, correct? I start XAMPP and VSCode open a CMD prompt as admin and runnetstat -ab
. There is an entryTCP 0.0.0.0:9000 [...] LISTENING [Code.exe]
... so I believe VSCode is listening ...