phpstorm配置使用xdebug

phpstorm配置使用xdebug

前言

没什么说的,就是个调试工具, 可以打断点监控程序运行和变量。

安装xdebug

选择对应php版本的下载安装,打不开的就FQ,安装步骤和装php扩展相同; 用MAMP集成环境的在面板里面勾选即可

下载安装:https://xdebug.org/download

配置php.ini

在php.ini中添加如下配置

; Xdebug 扩展本机所在绝对路径
zend_extension="/Applications/MAMP/bin/php/php7.4.1/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so"
; 0 为关闭,1 为开启
xdebug.profiler_enable=1
; 有关触发器的设置,写 0 即可
xdebug.profiler_enable_trigger=0
; Xdebug 日志记录的地址
xdebug.profiler_output_dir="/disk/xdebug"
; 同 xdebug.profiler_output_dir,配置请填写一致
xdebug.trace_output_dir="/disk/xdebug"
; 日志输出格式,按照我写就行
xdebug.profiler_output_name="xdebug.cache.%t-%s"
; 关于附加设置,具体未知,默认填 0 即可
xdebug.profiler_append=0
; 远程调试功能,0 关闭,1 开启,只要是与浏览器联调,请开启此功能
xdebug.remote_enable=1
; 联调的 URL 主机地址
xdebug.remote_host="localhost"
; 联调的请求端口,如果本机 9000 未被占用,请如此设置即可
xdebug.remote_port=9000
; 调试函数,默认 dbgp,不要对其修改
xdebug.remote_handler="dbgp"
; 与 PhpStorm 连接时的确认口令,默认 PHPSTORM
xdebug.idekey=PHPSTORM

配置完成后重启环境,用phpinfo查看是否安装配置成功

配置phpstorm

菜单: File -> Other Setting -> Preferences for New Projects

配置php路径,xdebug端口,dbgp协议

菜单: Run -> Edit Configurations

运行测试配置

菜单: Run -> Edit Configurations -> Web Server Debug Validation

验证是否可用,这里最后一个没通过也能使用,暂时没找到解决办法,如果有朋友解决了可以评论分享一下方法

浏览器配置

google安装xdebug插件

# 安装地址,需要FQ访问,访问成功后直接点击安装插件即可
https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc/related

安装插件成功后, 爬虫图标上右键 -> 选项

使用

参考资料

https://learnku.com/docs/the-laravel-way/5.6/Tao-2-1/2926
https://blog.csdn.net/qq_41566366/article/details/89878517

posted @ 2020-12-06 01:15  ranblogs  阅读(207)  评论(0)    收藏  举报