Help us understand the problem. What is going on with this article?

【Xdebug】VSCODE+PHP Laravel+Windows+Xamppでデバッグ実行

環境

Windows10 x64
VisualStudio Code 1.47.3
Xampp v3.2.4 (PHP 7.4.7)
VSCODEプラグイン PHP Debug v1.13.0(本記事でインストール~設定します)

Xdebugインストールと設定

①VSCODEでPHP Debugをインストール

image.png

②php.iniに下記を追記

※ C:\xampp\php\ext\php_xdebug.dllが存在しているか確認してください

C:\xampp\php.ini
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
[XDebug]
xdebug.remote_autostart = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "c:\xampp\tmp"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_log="c:\xampp\tmp\xdebug.txt"
xdebug.remote_port = 9000
xdebug.trace_output_dir = "c:\xampp\tmp"
xdebug.remote_cookie_expire_time = 36000

③「上部メニュー→実行→構成を追加」からlaunch.jsonを下記のようにする。

既に実行情報が記述されている場合は良い感じにマージする

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",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}

デバッグ実行してみる

①左メニュー→デバッグ(再生アイコンに虫が乗っているアイコン)を選択して、構成が「Listen for Xdebug」が選択されているのを確認

image.png

②あとはブレークポイントを仕掛けて「F5」でデバッグ実行

image.png

Laravelでも動作確認済み

XIGN
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした