PHP-PHP和IDEA调试配置

修订记录 版本 是否发布
2020-09-23 v1.0

一、安装PHP环境.

我安装的是集成环境(MAMP PRO)

二、IDEA安装PHP插件.

image-20200923174840346
image-20200923174840346

三、IDEA配置PHP环境.

image-20200923174941382
image-20200923174941382

image-20200923175011320
image-20200923175011320

点击Open in Editor打开php.ini 配置文件

image-20200923175140222
image-20200923175140222

PHP 的配置文件中php.ini 增加调试配置.


[xdebug]
zend_extension="/Applications/MAMP/bin/php/php7.2.8/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so"

;用来显示错误信息
display_errors = On
html_errors = On

;显示堆栈信息
xdebug.show_local_vars = 1
xdebug.max_nesting_level = 50
xdebug.var_display_max_depth = 6
xdebug.dump_once = On
xdebug.dump_globals = On
xdebug.dump_undefined = On
xdebug.dump.REQUEST = *
xdebug.cli_color = 2


;显示性能信息
xdebug.profiler_enable_trigger = on
xdebug.collect_params = On
xdebug.collect_return = On
xdebug.profiler_enable = On
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.trace_output_dir = "/Applications/MAMP/tmp"
xdebug.profiler_output_dir ="/Applications/MAMP/tmp"

;远程调试配置信息
;开启远程调试
xdebug.remote_enable = On
;远程处理协议
xdebug.remote_handel = dbgp
;IDE所在机器IP
;xdebug.remote_host = 127.0.0.1
;端口号
xdebug.remote_port = 9000
;IDE KEY
xdebug.idekey = "mykey"
xdebug.remote_connect_back= 1

注意:我安装的是集成环境,所有不用单独安装Xdebug,否则需要在安装PHP Xdebug模块。

四、配置 Xdebug调试端口,需要和配置文件中的端口号相同.

image-20200923175615673
image-20200923175615673

五、配置DBGp Proxy

注意:IDE key需要和配置文件中的xdebug.idekey = "mykey"保持一致

image-20200923175703179
image-20200923175703179

六、Google浏览器安装Xdebug helper 插件并进行以下配置.

右键选中,然后选择选项

image-20200923175938384
image-20200923175938384

配置IDE key

image-20200923180100271
image-20200923180100271

选择Debug

image-20200923180144232
image-20200923180144232

七、回到IDEA配置项目debug

image-20200923180349367
image-20200923180349367

选择Debug启动

image-20200923180300800
image-20200923180300800

完成

posted @ 2022-08-24 08:01  编程秀  阅读(131)  评论(0编辑  收藏  举报