在UEStudio中使用XDebug进行PHP调试

时间:2009-04-07 12:37:30

标签: php debugging xdebug

我刚刚下载了最新版本的UEStudio 09,我正在尝试集成的XDebug功能。

我已经安装了xdebug,并通过我的php_info()验证了这一点。我写了一个非常基本的脚本来测试它:

1:  <?php
2:  $x = 5;
3:  $y = $x + 1;
4:  $z = 10;
5:  while ($z--) {
6:      echo $x, $y, "<br />\n";
7:  }

然后我开始调试会话并在输出窗口中显示此消息:

Client: Listening for connection...

我在第4行添加了一个断点,只是为了测试它。然后我使用特殊的url参数在浏览器中打开文件:

http://localhost/uetest/index.php?XDEBUG_SESSION_START=test

脚本正常运行,不会停止调试或其他任何操作。输出是这样的:

Client: Listening for connection...
Client: Connection accepted
Client: Initializing session
==============================
Debug Engine Name: Xdebug
Debug Engine Version: 2.0.3
Protocol Version: 1.0
==============================
Client: Session active
Client Command: Step Into
Client: Exiting debug session
Script completed without errors

如果我访问http://localhost:9000/uetest/index.php,那么UEStudio会说“接受连接”,但从那里没有任何反应!该脚本永远不会在浏览器中完成,然后最终UEStudio崩溃。

有什么想法吗?

2 个答案:

答案 0 :(得分:1)

上周,我评估了UEStudio作为Zend Studio 5.5的替代品。我按照以下方式设置了我的XDebug配置并使其正常工作:

[XDebug]
zend_extension_ts=./ext/php_xdebug.dll
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_dir=d:/
xdebug.profiler_output_name=timestamp
xdebug.remote_enable=1
xdebug.remote_mode=req
xdebug.remote_autostart=0
xdebug.remote_port=9000
xdebug.remote_host=localhost 
xdebug.idekey=debug

我必须在php.ini中添加几个设置才能使其正常工作。以上是最终的配置。另外,我安装了XDebug Helper Firefox插件,从Firefox开始调试。非常方便。

答案 1 :(得分:0)

很多年前我使用过xdebug,但最近我一直在使用Zend Debugger,所以我不记得我为了让xdebug.dll工作而做了什么。但我确实记得我确实需要在php.ini中添加一些条目。我对Zend Debugger的条目是:

对于Linux:

[Zend]
zend_extension=/usr/lib/php5/20060613+lfs/ZendDebugger.so
zend_debugger.allow_hosts=127.0.0.1
zend_debugger.expose_remotely=always

对于Windows:

[Zend]
zend_extension_ts="c:/php/ext/ZendDebugger.dll"
zend_debugger.allow_hosts=127.0.0.1
zend_debugger.expose_remotely=always

谷歌搜索“php xdebug php.ini”把我带到了这里:

http://devzone.zend.com/article/2930-Debugging-PHP-applications-with-xdebug

这表明:

xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"

表示xdebug。

希望这有帮助。