vscode 配置xdebug

復制 phpinfo信息到 https://xdebug.org/wizard ,根據(jù)結(jié)果下載xdebug

image.png

將下載好的dll擴展放到php的ext目錄下并重命名xdebug.dll


image.png

打開php.ini配置文件在最下面增加

[XDebug]
 zend_extension = xdebug
 xdebug.mode=debug
 xdebug.start_with_request=yes
 xdebug.client_host=127.0.0.1
 xdebug.port=9003

打開vscode 添加插件php debug


image.png

配置xdebug的環(huán)境


image.png
{
    "version":"0.2.0",
    "configurations": [
        {
            "name": "Launch current script in console",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "externalConsole": false,
            "port": 9003
        },
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9003
        }
    
    ]
}

配置vscode


image.png

增加


image.png
{
    "security.workspace.trust.untrustedFiles": "open",
    "editor.multiCursorLimit": 20000,
    "extensions.ignoreRecommendations": true,
    "tabnine.experimentalAutoImports": true,
    "go.alternateTools": {},
    "workbench.editorAssociations": {
        "*.cap": "default"
    },
    "diffEditor.ignoreTrimWhitespace": false,
    "settingsSync.ignoredExtensions": [],
    "php.debug.executablePath": "C:\\phpstudy_pro\\Extensions\\php\\php8.0.30nts\\php.exe",
    "php.validate.executablePath": "C:\\phpstudy_pro\\Extensions\\php\\php8.0.30nts\\php.exe",
    "explorer.confirmDelete": false
}

重啟vscode后,任意位置打斷點


image.png

點擊啟動按鈕


image.png

控制臺中可看到監(jiān)聽中


image.png

在瀏覽器中訪問該地址
在vscode中即可看到對應(yīng)調(diào)試信息
image.png
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容