vscode調(diào)試php

php版本:7.2.3

1.安裝xdebug

通過(guò)phpinfo();發(fā)現(xiàn)沒(méi)有xdebug,所以需要下載安裝xdebug,下載網(wǎng)址:https://xdebug.org/download,下載對(duì)應(yīng)版本即可。

image.png

下載完成后將下載的文件放在:/php/ext目錄下,如下圖:
image.png

2.修改php.ini配置文件,在php.ini文件中添加

[XDebug]
zend_extension=E:\myServer\php\ext\php_xdebug-3.0.4-7.2-vc15-x86_64.dll
php-cgi.exe -b 127.0.0.1:9000-c E:/myServer/php/php.ini
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000
xdebug.remote_enable = 1
xdebug.remote_autostart = 1

3.配置vscdoe

(1)安裝php debug

image.png

(2)配置vscode

{
    // 使用 IntelliSense 了解相關(guān)屬性。 
    // 懸停以查看現(xiàn)有屬性的描述。
    // 欲了解更多信息,請(qǐng)?jiān)L問(wèn): https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        },
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 8089
        }
    ]
}
image.png
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

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

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