环境
我的环境是Eclipse for php+nginx+xdebug。
工具
- Eclipse for php
- Xdebug
具体步骤
立即学习“PHP免费学习笔记(深入)”;
1. 安装Xdebug
- 把下载好的xdebug文件放在php的ext目录下。

- 修改php.ini
在PHP文件夹里面找到php.ini,在这个文件的最后面加入如下配置信息:
【PS:“;”开头的语句为注释语句。我的xdebug版本为php_xdebug-2.4.0rc3-5.6-vc11.dll】
zend_extension = F:\DevEnv\PHP\ext\php_xdebug-2.4.0rc3-5.6-vc11.dll;zend_extension_ts = F:\DevEnv\PHP\ext\php_xdebug-2.4.0rc3-5.6-vc11.dll;extension = php_xdebug-2.4.0rc3-5.6-vc11.dll[Xdebug] xdebug.auto_trace = On xdebug.show_exception_trace = On xdebug.remote_autostart = On xdebug.remote_enable = On xdebug.collect_vars = On xdebug.collect_return = On xdebug.collect_params = On xdebug.trace_output_dir=”D:/xDebugLog” xdebug.profiler_output_dir=”D:/xDebugLog” xdebug.profiler_enable=On xdebug.remote_host=localhost xdebug.remote_port=9000 xdebug.remote_handler=dbgp
- 修改好后启动nginx与php。【PS:php本来已经启动的话要重新启动,因为修改了配置。】
2. 配置Eclipse
- 在Eclipse里打开项目,在项目的Properties里面找到”PHP Debug”进行配置。

- PHP Server我们选择新建一个。



最后剩下的Path Mapping可以不改。
选Finish,可以看到修改好的php server了。

OK,回到Properties界面,选择刚刚新建的php-test。

OK,php debug修改完。
最后还要配置一下Run->Debug Configurations。



所有配置完毕!
最后在Eclipse里测试一下: 
如果没问题Eclipse会自动进入debug模式。 
PS:也可以在浏览器输入网址访问,这时如果你的eclipse是打开的,而且php.ini的xdebug打开了,配置也没问题的话也是会进入eclipse的debug状态的。
好了,大家慢慢享受单步调试的乐趣吧哈哈哈~~~
参考文章:
Eclipse for php + Xdebug搭建PHP的调试环境
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });
以上就介绍了Eclipse for php+Xdebug,搭建php单步调试环境,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。











