Using VSCode, when I put a breakpoint in a PHP file, start the debugger and click the Run and Debug button, debugging works as expected. Execution stops on the breakpoint and information is shown in the left side bar. But when I initiate the same process using the "Listen for Xdebug" dropdown (after creating the launch.json file as described below) and then reload the PHP file in question in my browser, the breakpoint is ignored and the webpage loads. In the past when this was working, reloading the page would trigger debugging, but after I reinstalled VSCode and WinNMP, something has changed and I don't know what.
I installed Xdebug using https://xdebug.org/wizard, and followed the instructions:
Download php_xdebug-3.1.5-8.0-vs16-nts-x86_64.dll
Move the downloaded file to ext, and rename it to php_xdebug.dll
Update D:\winnmp\conf\php.ini and add the line:
zend_extension = xdebug
Restart the webserver
My Xdebug PHP.INI is:
zend_extension = xdebug
xdebug.mode = debug
I added the xdebug.mode line since that's what Xdebug instructs to get step debugging.
I deleted a prior launch.json file that was there, and For the launch.json, I clicked on Run > Add Configuration > PHP Listen for Xdebug, which generated this launch.json;
{
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
}
]
}
I'm using Firefox Developer as my browser. Refreshing a webpage that I've opened in VSCode and with a breakpoint set has no effect on the debugging in VSCode. I've tried launching Firefox in the CMD window:
"C:\Program Files\Firefox Developer Edition\firefox.exe" -start-debugger-server
and there is no difference. I changed the launch.json to:
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Firefox",
"type": "firefox",
"request": "attach"
}
]
}
and debugging isn't affected.
I've installed several Firefox extensions, in turn, Xdebug-helper, Xdebug-ext, and Zend-debugger Toolbar. None of them had any effect. What DID have some effect was installing the VSCode extension, Debugger for Firefox. In the extension's options I set the Port to 9003 and entered the absolute path for firefox.exe. After doing this, when I start the debugger, Firefox asks for permission to connect to the remote debugger. I click yes, but then the breakpoint becomes an open gray circle, and, if I refresh the webpage, debugging doesn't occur.
Here is the print out from xdebug_info(). Debugger = Not Active seems wrong, but I don't know what to do with that if it is actually something wrong.
Version 3.1.5
Support Xdebug on Patreon, GitHub, or as a business
Enabled Features
(through 'xdebug.mode' setting)
Feature Enabled/Disabled Docs
Development Helpers ✘ disabled