1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【PHP】VSCodeのXdebug設定

1
Posted at

VSCodeでPHPをXDebugするのに苦戦したので備忘録

WSL2 & Docker 前提です。

xdebug.ini
zend_extension=xdebug
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_host=host.docker.internal
xdebug.client_port={PORT}
docker-compose.yml
web:
# ...
  extra_hosts:
     - "host.docker.internal:host-gateway"
.vscode/launch.json
{
    "name": "Listen for Xdebug",
    "type": "php",
    "request": "launch",
    "port": {PORT}, //xdebugのiniポートと合わせる
    "pathMappings": {
        "/var/www/html": "${workspaceFolder}" // Dockerコンテナ内のウェブルートパス
    }
},

反映されない場合はビルドし直すとよい
docker compose up -d --build

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?