修改php配置 并重启服务
v3.*
[XDebug]
xdebug.output_dir="/mnt/c/Users/Administrator/Desktop/xdebug"
xdebug.mode = debug
xdebug.client_host = 127.0.0.1
xdebug.client_port = 9002
xdebug.start_with_request = yes
v2.*
[Xdebug]
zend_extension=F:/phpstudy_pro/Extensions/php/php7.3.4nts/ext/php_xdebug.dll
#0 1 2 3 4#调试详细显示
xdebug.collect_params=2
xdebug.collect_return=1
#xdebug.auto_trace=On
#xdebug.trace_output_dir=F:/phpstudy_pro/Extensions/php_log/php7.3.4nts.xdebug.trace
;性能分析开关
xdebug.profiler_enable=On
xdebug.profiler_output_dir=Z:/tmp
;远程调试是否开启
xdebug.remote_enable=On
xdebug.remote_host=localhost
xdebug.remote_port=9002
xdebug.remote_handler=dbgp
;vscode靠这个配置断点 开启关闭
xdebug.remote_autostart=1
;自定义名称
xdebug.profiler_output_name = "cachegrind.out.%s"
xdebug.collect_includes=1
[Xdebug]
xdebug.remote_enable=On
xdebug.remote_autostart=1
xdebug.collect_params=2
xdebug.collect_includes=1
xdebug.remote_port=9002
[Xdebug]
;2021年2月21日 04:26:02 最新配置
xdebug.remote_enable=On
xdebug.remote_autostart=1
xdebug.collect_params=2
xdebug.collect_includes=1
xdebug.collect_vars=1
xdebug.remote_port=9002
;自动记录瓶颈XDEBUG_PROFILE
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_dir = "/www/wwwlogs/debug/profiler"
xdebug.profiler_output_name = cachegrind.out.%u
;自动记录内存消耗XDEBUG_TRACE
xdebug.auto_trace=0
xdebug.trace_enable_trigger=1
xdebug.trace_format=2
xdebug.show_mem_delta=1
xdebug.trace_output_name = trace.out.%u.html
xdebug.trace_output_dir = "/mnt/c/Users/Administrator/Desktop"
xdebug.var_display_max_children=512
xdebug.var_display_max_data=512
xdebug.var_display_max_depth=15
在vscode里安装插件
添加配置
设置端口9002 跟之前配置一样
性能分析安装
去https://github.com/jokkedk/webgrind
下载源码
webgrind\config.php
修改
static $storageDir = 'Z:/tmp';
static $profilerDir = 'tmp';
进入webgrind
完成
最后加上linux与win的vscode配置
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Linux_XDebug",
"type": "php",
"request": "launch",
// "stopOnEntry":false,
"localSourceRoot": "${workspaceRoot}",
"serverSourceRoot": "/mnt/d/word",
"port": 9002
},
{
"name": "Windows_XDebug",
"type": "php",
"request": "launch",
// "program": "${file}",
// "cwd": "${fileDirname}",
// "localSourceRoot": "${workspaceRoot}",
// "serverSourceRoot": "/mnt/d/word",
"port": 9002
}
]
}