vscode调试php

php版本:7.2.3

1.安装xdebug

通过phpinfo();发现没有xdebug,所以需要下载安装xdebug,下载网址:https://xdebug.org/download,下载对应版本即可。
vscode调试php_第1张图片
下载完成后将下载的文件放在:/php/ext目录下,如下图:
vscode调试php_第2张图片

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

vscode调试php_第3张图片

(2)配置vscode

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: 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
        }
    ]
}

vscode调试php_第4张图片

你可能感兴趣的:(php学习,php)