php xdebug调试工具
tips:使用谷歌应用商店下载插件,建议先翻墙,可以使用setupVPN插件(谷歌浏览器可以用的翻墙插件)
-
安装xdebug扩展库
windows: 网上下载phpxdubug扩展,把扩展文件放入php对应的ext目录中,并且在php.ini中的xdebug设置指定xdebug.dll路径[XDebug] xdebug.auto_trace=on xdebug.auto_profile = on xdebug.profiler_enable_trigger = On xdebug.profiler_output_dir="E:\phpstudy2018\PHPTutorial\tmp\xdebug" xdebug.trace_output_dir="E:\phpstudy2018\PHPTutorial\tmp\xdebug" xdebug.remote_enable=1 xdebug.remote_autostart = Off xdebug.idekey=PHPSTORM xdebug.remote_handler = dbgp ;xdebug.remote_host = localhost xdebug.remote_host = 127.0.0.1 xdebug.remote_port=9001 zend_extension="E:\phpstudy2018\PHPTutorial\php\php-7.2.1-nts\ext\php_xdebug.dll"
2 lunux下安装xdebug
下载xdebug扩展,安装完成后配置php.ini,php -m查看xdebug模块是否安装成功
[xdebug]
zend_extension=xdebug.so
xdebug.remote_enable =1
xdebug.remote_host = "192.168.56.1"
xdebug.remote_mode = "req"
#xdebug.remote_handler="dbgp"
xdebug.idekey="PHPSTORM"
xdebug.remote_connect_back = 1
xdebug.scream=0
xdebug.cli_color=1
xdebug.show_local_vars=1
xdebug.remote_autostart = Off
xdebug.remote_port=9000
3、配置phpstorm
首先配置php下的debug,期中port对应php.ini中设置的端口号,默认9000
然后配置servers
以及dbgp代理,ide key与php.ini一致,设置为PHPSTORM
运行配置
以上基本配置好phpstorm的xdebug相关配置
xdebug helper插件的使用(google)
Xdebug helper Chrome插件使用方法
1,用户可以在chrome浏览器中的应用商店上添加 Xdebug helper扩展,也可以从本站离线下载安装:chrome插件的离线安装方法。最新谷歌浏览器下载地址:http://chromecj.com/category/chrome/。
2,安装完成xdebug helper后再浏览器地址栏的右侧能够看到一只小爬虫,点击后如下图所示:
Xdebug helper图片
3,选择Debug,就会通知你的开发环境接下来的代码需要开始调试,选择disable,就会直接运行。如下图所示:
Xdebug helper图片
4,在xdebug helper中配置它,选择phpstorm并且在右边的框中填入PHPSTORM。
Xdebug helper Chrome插件使用方法
5,到这里所有的配置已经完成了,可以phpstorm中设置断点,然后使用浏览器的xdebug helper开启页面调试。
Xdebug helper图片
6,xdebug helper常用热键:
- Ctrl + Shift + X(Mac上的Cmd + Shift + X)打开弹出窗口。
- Alt + Shift + X切换调试状态。
Xdebug helper Chrome插件注意事项
1.在eclipse中需要进行特别的设置:
进入window->Preferences->PHP->Debug
找到配置xdebug中的Accept remote session(JIT),选择为localhost,并保存。
2.在PHP的配置文件中对xdebug的设置需要特别注意,将xdebug.remote_autostart设置为off,如果设置为on,则会忽略在浏览器中是选择Debug还是Disable,都会通知eclipse进行调试
xdebug.remote_autostart = Off。这样,xdebug helper就设置好了
xdebug helper的优势
使用该插件主要是为了弥补xdebug本身的局限,直接使用phpstorm xdebug调试的话,设置的断点需要每次都重头运行到断点处,而不能灵活的终止或者其他操作
xdebug helper就可以实现这个功能。需要终止的时候选择disable选项即可,而不需要从头开始