在hbuilder中利用xdebug helper 断点调试php

来源:互联网 发布:u8用友软件介绍 编辑:程序博客网 时间:2024/04/30 11:00

1. 在php.ini最后面添加下面的配置, 添加后需要重启apache

zend_extension="C:\lijinlong\JAVA\php-5.6.30-Win32-VC11-x64\ext\php_xdebug.dll" //这里是xdebug的扩展
xdebug.remote_enable = On
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000
xdebug.remote_handler = "dbgp"
xdebug.auto_trace = 1
xdebug.collect_includes = 1
xdebug.collect_params = 1
xdebug.collect_return = 1
xdebug.default_enable = 1
xdebug.collect_assignments = 1
xdebug.collect_vars = 1
xdebug.remote_autostart = Off // 必须是off, 如果是On, 会误事浏览器的debug, 而直接进入ide
xdebug.remote_connect_back = 1
xdebug.show_local_vars = 1
xdebug.show_exception_trace = 0


或者最简单的配置

zend_extension="D:/php5.6/php_xdebug.dll"
xdebug.remote_enable = On
xdebug.remote_handler = dbgp
xdebug.remote_host= localhost
xdebug.remote_port = 9000


2. 在chrom浏览器中添加 xdebug helper 扩展

下载xdebug helper 扩展, 下载地址

http://chrome-extension-downloader.com/

搜索框中输入

https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc

这是插件的地址, 回车即可下载

如果访问不了google(你懂得), 可以在这里下载

http://download.csdn.net/detail/u011526234/9833736

下载完成之后安装(不会安装的自行百度)

3. 配置xdebug helper

在扩展程序中找到 xdebug helper , 点击选项, 出现下面的图片


在ide key中选择自己的ide, 我用的是hbulder, 所以选择的是other, key是自己定义的, 随便取就好


4. 配置hbulder


配置完成之后就可以了, 注意 debug port 要与php/ini中的port一致

使用的时候浏览器上面的小甲虫要选择 debug


另外, 如果开启了调试模式, 会发现进入任何页面都会从第一行进行调试, 在网上查了一下, 发现eclipse也有这样的问题, 说是 breakpoint at first line 什么选项去掉, 但是hbuilder 没有找到, 后来偶尔一次操作, 发现进入调试时, 弹出了一个页面(忘了截图), 问是否breakpoint at first line , 选了否, 然后发现可以从断点开始了. 具体操作(都是一点一点试的, 不知道是否是这个原因, 只能记录下来):


当默认进入第一行时(没有往下走), 我点图中的第一个, 关闭了编辑器中的页面, 然后点第二个, 关闭了调试, 当我再打开调试的时候, 就提示我是否从第一行开始调试, 我选择了否, 然后就好了

ps: 在第一次调试的时候发现, 进入debug模式时, f6快捷键(单步跳过)不好用, 只能用鼠标去点上面的箭头, 很痛苦, 查了一下资料, 具体不知道什么原因, 可能是快捷键冲突, 也可能是联想笔记本fn键锁定了, 我的解决方法是把这个快捷键改了, 改成了M, 发现好使, 试了一次之后, 又改回了f6, 发现也好使了, 不知道什么原因

0 0
原创粉丝点击