安装x-debug
- 打印自己的phpinfo(),全选、复制到 https://xdebug.org/wizard
- 提交后,安装页面的提示步骤来:
配置php.ini
- 安装成功后,配置php.ini,加入以下内容内容:
zend_extension = E:\xampp\php\ext\php_xdebug-2.9.4-7.3-vc15-x86_64.dll
;开启远程调试,连接和监听主机和端口的调试客户端
xdebug.remote_enable = On
;启用代码自动跟踪
xdebug.auto_trace=On
;允许收集传递给函数的参数变量
xdebug.collect_params=1
;允许收集函数调用的返回值
xdebug.collect_return=On
;客户机ip
xdebug.remote_host="127.0.0.1"
;客户机xdebug监听端口和调试协议
xdebug.remote_port=9000
;启动调试器协议dbgp
xdebug.remote_handler=dbgp
;指定DBGP调试器(IDE)处理程序区分大小写
xdebug.idekey="PHPSTORM"
;启用性能检测分析
xdebug.profiler_enable = On
;关闭性能检测分析触发器
xdebug.profiler_enable_trigger = off
;指定性能分析文件的存放目录
;xdebug.profiler_output_dir = "e:\tmp"
;指定性能分析文件的名称
;xdebug.profiler_output_name = cachegrind.out.%t.%p
;指定堆栈跟踪文件的存放目录
;xdebug.trace_output_dir="e:\tmp"
;指定堆栈跟踪文件的名称
;xdebug.trace_output_name = trace.%c
- 重启webServer
配置phpStorm
- File --> Settings --> Languages & Frameworks --> PHP --> Debug
图解一:
图解二:
图解三:
验证图解: