php.ini里添加xdebug配置信息:php
zend_extension = /usr/local/php5.6/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so xdebug.idekey="sublime.xdebug" xdebug.remote_enable = On #开启远程调试 xdebug.remote_port = 9900 #远程IDE服务器监听端口 xdebug.remote_handler = "dbgp" #使用的协议 xdebug.remote_req = req xdebug.remote_connect_back=1
谷歌浏览器安装xdebug helper扩展工具:html
点击浏览器右上角三条横杠,选择更多工具->扩展程序web
安装成功后,点击xdebug helper的选项:浏览器
在IDE key里选择other而且填入sublime.xdebug,保存便可:服务器
打开sublime text3,点击左上角的Project->Edit Project,配置对应的信息,其中只要配置xdebug相关信息便可,其余的会自动生成,虚拟机的配置有映射路径,整个文件的配置信息以下(若是无远程路径,path_mapping里面的参数能够为空不填):app
{ "folders": [ { "path": "F:\\work\\www\\my\\testdebug" }, { "path": "D:\\xampp\\htdocs\\wmcs" }, { "path": "F:\\work\\www\\work\\dfh3" }, { "path": "F:\\work\\www\\work\\cms" }, { "path": "F:\\work\\www\\work\\zjss" }, { "path": "F:\\work\\www\\work\\ppjt" }, { "path": "F:\\work\\www\\my\\tp5" }, { "path": "F:\\work\\www\\work\\website" } ], "settings": { "xdebug": { "path_mapping": { "/home/wwwroot/my/testdebug": "F:/work/www/my/testdebug" //远程Linux与本地window项目的对应存放关系 }, "super_globals": true, "close_on_stop": true, "url": "www.testdebug.com",//项目域名 "port": 9900, //xedebug端口 } } }
若是没有虚拟机,那么配置就改成:编辑器
{ "folders": [ { "path": "E:\\phpstudy\\www\\trade" } ], "settings": { "xdebug": { "close_on_stop": true, "ide_key": "sublime.xdebug", "port": 9900, "super_globals": true, "url": "http://localhost/trade" } } }
接下来就是启用xdebug来调试代码了,sublime text3编辑器开启调试,快捷方式ctrl+shift+f9,谷歌浏览器臭虫点击为绿色,刷新浏览器,编辑器里就能够看到对应的调试信息了:ide
sublime text3调试的快捷方式:函数
ctrl+f8 新增/删除 断点
ctrl+shift+f9 启动xdebug模式
ctrl+shift+f7 进入函数
ctrl+shift+f10退出xdebug模式
ctrl+shift+f11隐藏xdebug面板工具
相关信息:
Centos 下php安装配置xdebug:http://www.javashuo.com/article/p-pydgfeqm-ea.html
谷歌浏览器xdebug helper扩展工具下载地址:https://pan.baidu.com/s/1Q-wlLq8LSTaYMP3fA4CvOg