VSCodeでXdebugが動かない…
はじめに
「VSCode Remote Container」とPHPでプログラミングしていますが、Xdebugが動かなくてデバッグが出来ない事象に悩まされました。2020/11/25にXdebug3がリリースされ、その時期からXdebugが動かなくなった模様です。
Xdebug3からiniの書き方が変わったので、ネットに出回っている書き方だとうまく行きません。本記事ではXdebug3ではどの様にiniを記述するのか。それに対応したlaunch.jsonの書き方についてまとめてみました。
Xdebug3での新しいini
ネットで出回っているiniの記述は以下の通りかと思います。
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.remote_host="localhost"
xdebug.remote_port=9001
Xdebug3でのiniは以下の通りとなります。
xdebug.client_host=localhost
xdebug.client_port=9003
xdebug.idekey=PHPSTORM
xdebug.mode=develop,debug
xdebug.start_with_request=yes
VSCodeのlaunch.jsonはこうなる
先程のiniファイルに対応したlaunch.jsonは以下の通りとなります。
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003
}
]
}
さいごに
Xdebug3になってiniの書き方が大分と変わっています。
最新の情報でphpのデバッグライフを楽しみたいですよね。
ディスカッション
コメント一覧
まだ、コメントがありません