远程调试环境配置

一、vscode中使用xdebug调试php

1.php中打开xdebug 

远程调试环境配置_第1张图片

2、打开php.ini,修改配置

[Xdebug]
zend_extension=D:/PHP/Extensions/php/php5.6.9nts/ext/php_xdebug.dll
xdebug.collect_params=1
xdebug.collect_return=1
xdebug.auto_trace=Off
xdebug.trace_output_dir=D:/PHP/Extensions/php_log/php5.6.9nts.xdebug.trace
xdebug.profiler_enable=Off
xdebug.profiler_output_dir=D:/PHP/Extensions/php_log/php5.6.9nts.xdebug.profiler
xdebug.remote_enable=Off
xdebug.remote_host=localhost
xdebug.remote_port=9003
xdebug.remote_handler=dbgp

3、下载PHP Debug、PHP Intelephense、PHP Xdebug这三个插件

远程调试环境配置_第2张图片

 4.修改vscode配置

在文件 首选项的设置中 

5.打开settings.json增加php的路径

"php.debug.executablePath": "D:\\PHP\\Extensions\\php\\php5.6.9nts\\php.exe",
 "php.validate.executablePath": "D:\\PHP\\Extensions\\php\\php5.6.9nts\\php.exe"

远程调试环境配置_第3张图片

6、配置launch.json,注意端口号要跟php.ini中一致

{
    "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
        }
    
    ]
}

7.远程调试

你可能感兴趣的:(安全)