Turn on XDebug only when you need it in Visual Studio Code
Sep 10, 2020
PHP
PHPUnit
xdebug
Visual Studio Code
Thing you want to do
- I want to do Turn on xdebug only when needed with Visual Studio Code
#Install
#Setting launch.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",
"cwd": "$ {fileDirname}",
"runtimeExecutable": "/ usr / local / bin / php",
"runtimeArgs": [
"-d",
"zend_extension = xdebug.so",
"-d",
"xdebug.remote_enable = 1",
"-d",
"xdebug.remote_autostart = 1",
"-d",
"xdebug.remote_host = localhost",
"-d",
"xdebug.remote_port = 9001"
],,
"program": "$ {workspaceRoot} / vendor / bin / phpunit",
"args": ["$ {file}"],
"port": 9001,
"log": false
}
]
}