search
LoginSignup
0

More than 1 year has passed since last update.

posted at

updated at

Laravel Sail + Xdebug + VS Codeでのデバッグ

  • sail artisan sail:publish を実行して Dockerfile を出す。
  • Dockerfileapt-get install -y php-xdebug を差し込む。
  • php.ini に下記追加
[XDebug]
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_host = host.docker.internal
  • sail build --no-cache を実行。
  • VS Codeに 拡張機能 PHP Debug を入れる。
  • .vscode/launch.json に下記設定を追加。
{
    "name": "Listen for XDebug",
    "type": "php",
    "request": "launch",
    "stopOnEntry": true,
    "port": 9003,
    "pathMappings": {
        "/var/www/html": "${workspaceFolder}"
    },
    "hostname": "localhost",
    "xdebugSettings": {
        "max_data": 65535,
        "show_hidden": 1,
        "max_children": 100,
        "max_depth": 5
    }
}
  • VSCodeにてデバッグ開始。 終わり。

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
What you can do with signing up
0