I have installed PHP Debug
plugin in VSCode
, unfortunately, it didn't give me any automation on creating launch configurations. For example, Add Configuration
doesn't give me PHP
option
(there is no PHP option anywhere below)
In documentation in section VS Code Configuration
it is said sample configurations appear on Gear icon click, but this doesn't work for me (nothing happens on gear click).
My Answer:
Here is an example of a PHP Debug configuration in VSCode:
json
{
"version": "0.2.0",
"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
}
]
}
You can add this configuration to your launch.json file in VSCode by clicking on the gear icon in the Debug view and selecting "Add Configuration". Then paste the above configuration into the launch.json file.
You can then select one of these configurations from the dropdown menu in the Debug view and start debugging your PHP code.
Rate this post
3 of 5 based on 5729 votesComments