I am trying to set up debugging in VSCode and have run into a bit of a challenge. I typed the path to the localSourceRoot but Intellisense is telling me that it is deprecated and I should use pathMapping instead.
I am a newbie and don't know how to properly set that up. If someone could explain to me the variables and/or attributes pathMapping is requesting I would be forever in your debt.
My system info is as follows: PHP version: 5.524 xdebug version: 2.2.5 OS Windows 8.1 Using Desktop Server version: 3.8.5
I checked the phpinfo() and it shows Xdebug in the file so I know that it is installed. The launch.json file is pretty basic with port 9000 and all of that. I just need to get that darned pathMapping thing done.
Thanks for any and all help.
Add a new configuration#Use IntelliSense if your cursor is located inside the configurations array. Press the Add Configuration button to invoke snippet IntelliSense at the start of the array. Choose Add Configuration option in the Run menu.
PHP debugging with XDebug is supported through a PHP Debug extension. Follow the extension's instructions for configuring XDebug to work with VS Code.
I guess you're using the PHP debug extension ?
https://github.com/felixfbecker/vscode-php-debug
The README.md says the following:
To debug a running application on a remote host, you need to tell XDebug to connect to a different IP than localhost. This can either be done by setting xdebug.remote_host to your IP or by setting xdebug.remote_connect_back = 1 to make XDebug always connect back to the machine who did the web request. The latter is the only setting that supports multiple users debugging the same server and "just works" for web projects. Again, please see the XDebug documentation on the subject for more information.
To make VS Code map the files on the server to the right files on your local machine, you have to set the pathMappings settings in your launch.json. Example:
// server -> local
"pathMappings": {
"/var/www/html": "${workspaceRoot}/www",
"/app": "${workspaceRoot}/app"
}
Please also note that setting any of the CLI debugging options will not work with remote host debugging, because the script is always launched locally. If you want to debug a CLI script on a remote host, you need to launch it manually from the command line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With