> For the complete documentation index, see [llms.txt](https://php7.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://php7.shujuwajue.com/phpff17-diao-shi/xdebug/shi-yong-eclipse-diao-shi.md).

# 使用Eclipse调试

## 章节

* Eclipse 安装
* Xdebug 安装
* Eclipse 和 Xebug的配置
* The easiest Xdebug 浏览器插件安装
* 配置host的网站,如何配置Xdebug?

## Eclipse安装

详见开发工具章节里的Eclipse 安装与配置

> 教程所使用的Eclipse版本: Eclipse for PHP Developers Version: Neon.3 Release (4.6.3)

![](/files/-LfnTFmVl6elImcWxzOT)

## Xdebug 安装

详见Xdebug章节

## Eclipse 和 Xebug的配置

1\).进行php相关配置: (`Window->Preferences->PHP`）![](/files/-LfnTFmYducbOnMxpoGq)![](/files/-LfnTFm_6-If80g8khgj)

2）配置PHP运行程序（`PHP->PHP Executables->Add`）

> 注意我使用的此版本已经配置好,如果您的Eclipse版本不存在,则Add

![](/files/-LfnTFmcWeUGLBlH9Stc)

填入名字，可随意，建议填写本机安装的PHP版本号，填写php.exe和php.ini的路径，将PHP debugger选为XDebug（Zend Debugger原先是由Zend公司维护的，但现在貌似Zend公司已经将其集成到了自己旗下的一款产品Zend Server里，不再独立维护，因此只支持到PHP5.2.6，不适用于现在的PHP7.0版本了），我的配置见下图：

![](/files/-LfnTFmelZkr2gv7mW1f)

![](/files/-LfnTFmgaQRPKWLsBHlW)

3）配置运行环境: ( `PHP->PHP Executables->Execution Environment->php7.0`），勾选左侧你刚刚配置的PHP运行程序（这里可能要在上一步完成之后先OK一下把配置窗口关掉，再重新打开）。

![](/files/-LfnTFmiMtTFwikDdI1C)

4）选择php版本: ( `PHP->Interpreter`）

![](/files/-LfnTFmk7I4Y6GAIiMWk)

5）配置服务器

![](/files/-LfnTFmmnPljFs6BwxPh)

6）配置xdebug

![](/files/-LfnTFmoIqL4LYwEPQX7)![](/files/-LfnTFmqGDFUhrsbx2ik)![](/files/-LfnTFmsRvNHBSKB8zrr)

配置完成

## The easiest Xdebug 浏览器插件安装

可以去火狐扩展当中搜索安装

![](/files/-LfnTFmu0Aiw-r0Q8qas)

配置

![](/files/-LfnTFmwSKq_wdcA5fKc)

现在就可以完全安装完成,点亮右上角那个小虫图标插件即可进行调试.

## 配置host的网站,如何配置Xdebug?

当您配置自定义解析的本地的网站

```
cat /etc/hosts
-----------
127.0.0.1 test.local
```

点击Ecliplse debug的小虫图标,点击Debug configurations ![](/files/-LfnTFmyVCfuci6Hco-D)添加一个新的PHP Web Application 下面是我的配置

```
/test/public/index.php  为项目的入口文件
```

![](/files/-LfnTFn-E2Kq26HH_T8F)

配置完成后即可在你的网站中打断点, 打开firfox,浏览<http://test.local,点亮右上角的小虫插件,进行调试>

## 资料

[Eclipse集成PDT+XDebug调试PHP脚本](http://pjdong1990.iteye.com/blog/1610305)

[Eclipse 的单步调试](http://www.cnblogs.com/mq0036/p/3780538.html)

[eclipse快捷键调试总结](http://www.cnblogs.com/yxnchinahlj/archive/2012/02/22/2363542.html)

[Eclipse 在Debug调试中用到的快捷键](http://www.cnblogs.com/David-Young/p/4451375.html)
