0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Laravel Sail】ブラウザ上でXdebugを止めたい

Posted at

ブラウザ上でDocker上のxdebugを止めたい場合の記録

sailをdown

terminal
./vendor/bin/sail down

.envに追加

.env
SAIL_XDEBUG_MODE=develop,debug

.dockerに下記追加

プロジェクト名/vendor/laravel/sail/runtimes/8.1/Dockerfile
RUN apt-get update \
php8.1-memcached php8.1-pcov php8.1-xdebug

ターミナルで下記コマンドを順に実行

terminal
./vendor/bin/sail build --no-cache
./vendor/bin/sail up -d 
./vendor/bin/sail artisan sail:publish
./vendor/bin/sail stop
./vendor/bin/sail up

vscodeの設定

launchjsonに下記追加

launch.json
       {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "pathMappings": {
                "/var/www/html": "${workspaceFolder}"
            },
            "hostname": "localhost",
            "xdebugSettings": {
                "max_data": 65535,
                "show_hidden": 1,
                "max_children": 100,
                "max_depth": 5
            }
        },

デバッガー起動

ブラウザでlocalhost起動

指定した箇所でブレークポイントが止まる。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?