Eclipse: Eclipse Platform, Version: 3.3.0, Build id: I20070621-1340
PHP: Version 5.2.0
Xdebug: Version 2.0.0
Apache: Version 2.0.59
1、配置apache+php,网上很多,不细说;
2、配置Xdebug;
1)、下载相应模块:PHP 5.2.1+(php_xdebug-2.0.0-5.2.2.dll);
2)、将下载的dll复制到php.ini所在目录;
3)、编辑php.ini文件,添加:
[xdebug]
xdebug.remote_enable = 1
xdebug_remote_host = “192.168.1.25″
xdebug.remote_port = 9000
xdebug.remote_handler = “dbgp”
zend_extension_ts=.\php_xdebug-2.0.0-5.2.2.dll
这些配置比较简单,一看就明白。另,俺上个文章讲的是使用Zend Debugger 5.2.10 + Zend Studio 5.5.0调试web,所以,如果您配置了用Zend Debugger调试web的话,请将
[Zend]
zend_extension_ts=.\ZendDebugger.dll
zend_debugger.allow_hosts=192.168.1.25
zend_debugger.expose_remotely=always
等4行注释掉。
4)、重启apache,打开浏览器运行:http://192.168.1.25/phpinfo.php,您会看到:
![]()
3、配置Eclipse;
1)、可以使用Eclispe的插件功能安装PDT:http://downloads.zend.com/pdt,会用Eclipse的都知道怎么用;
2)、您也可以直接下载org.eclipse.php和org.zend.php.debug,自己安装插件;
3)、Eclipse >> Window >> Preferences >> PHP项;
1)、PHP executables,新建一个,PHP Debugger选择Xdebug。您可以将这个新加的设置默认;
2)、Debug中,PHP Debugger选择Xdebug;Installed Debuggers中,Xdebug的端口设置为您在php.ini中设置的xdebug.remote_port;
3)、Debug子项Launching中,Xdebug不支持“Allow multiple debug sessions”,所以设置为Never即可;
4)、PHP Servers中,您可以根据自己的需要,选择“Publish Projects to this Server”,俺没有选择;
4)、Run >> Open Debug Dialog,如图:
请注意:Auto Generate项,如果您的web有子路径,则可能需要自己设置一下。Advanced标签,不选:Open in Browser。Common标签,根据您web的编码,设置Console Encoding。
以上设置后,在Open Debug Dialog的对话框中,点击底部的“Debug”即可进行web调试。以后只要在Run >> Debug History中选择此次调试名称就可以了。
在配置中,有很多步骤没有仔细说明,是因为这些步骤是Eclipse的基本概念。
现在eclise和zend studio都可以调试web了,不过我还是喜欢用eclispe。^_^。
相关站点:
PDT Project: http://www.eclipse.org/pdt/
Zend.com / pdt : http://www.zend.com/pdt
One Ping to “使用Eclipse PHP Development Tools + xdebug 2.0.0 调试web”
9 Responses to “使用Eclipse PHP Development Tools + xdebug 2.0.0 调试web”
-
1. Lonely Says:
十一月 25th, 2007 at 18:16想请问一下Eclipse PDT带的两个调试器如何远程调试,我的服务器是LINUX,Eclipse是安装在windows上的。谢谢!
-
2. 馒头 Says:
十一月 25th, 2007 at 22:17不好意思,我没有实验过服务器不在本地的做法,等我试验后,再说。
-
3. aaron Says:
一月 10th, 2008 at 11:04能不能举个debug的例子啊,我这边一直debug无反应。
烦请回复一下邮件 -
4. 馒头 Says:
一月 11th, 2008 at 13:24调试方法和用eclipse调试其他程序一样,比如调试java。
你的pdt和xdebug是否配置好了?只调试php,不调试web是否可以? -
5. junphine Says:
一月 13th, 2008 at 20:30为什么设置的断点没有起作用?
-
6. 馒头 Says:
一月 14th, 2008 at 17:51junphine,你进入调试进程了吗?没有起作用,那就是xdebug没有配置好。
默认设置是中断在第一行,然后便可以进行调试。 -
7. Erik Says:
八月 11th, 2010 at 20:06记得在5.3后,不能用zend_extension_ts加载XDebug了,要用zend_extension,这个问题我搞了一个晚上。
-
8. Erik Says:
八月 11th, 2010 at 22:43请问:
xdebug.remote_handler = “dbgp”
这句是什么用的?
加上这句后,会有提示.remote_handler = “dbgp” is not supported 是什么意思啊? -
9. 馒头 Says:
八月 20th, 2010 at 12:08dbgp是一种调试通讯协议.
http://www.xdebug.org/docs/remote
http://xdebug.org/docs-dbgp.php你的xdebug版本是多少?
七月 23rd, 2008 at 11:28
[...] like it. Ha Ha.)文章在这儿,http://yuntian.name/?p=12 当然,类似的这些文章可能都来源于IBM网站的这两篇: [...]