| | PHP&DB&...

PHP Remote Debugging,另一个比较流行的调试模块是Xdebug。Xdebug,使用上非常方便,在遇到exception的时候,能够将Application当前的状况,变量、call trace等信息,友好地直接输出到web页面上。

Xdebug上下载Xdebug for PHP的扩展模块,将其置于PHP的ext目录中。在php.ini中增加,

extension=php_xdebug.dll

xdebug.show_exception_trace=on
xdebug.show_local_vars=on

这样就可以在Web Application遇到语法或值溢出等exception的时候,显示相关变量和调用堆栈。

对于PHP Remote Debugging,需要在php.ini中对Xdebug进行更多的设置。

zend_extension_ts="ext/php_xdebug.dll"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=<idekey>
xdebug.show_exception_trace=on
xdebug.show_local_vars=on
xdebug.show_mem_delta=on

并将和Zend Optimizer有关的选项全部关闭。在phpinfo()中,检查是否成功启动Xdebug。

Xdebug支持多个调试协议,GDBDBGp和PHP3。这里使用的是DBGp,一个基于XML的多语言调试协议。

目前,Xdebug的最新版本是2.0.0 Beta。和DBG Debugger相比,支持Xdebug的IDE还不太多。这里以Komodo为例,说明基于Xdebug扩展,如何进行Remote Debugging。

>>内文分页: [1] [2]

This entry comes from 本站原创.It has been read for 1207 times.You may Leave a comment or 引用(0) this entry.
0 comments so far
Leave something
Name:


Website:


E-mail:


Content:
打开HTML 打开UBB 表情 打开表情 隐藏 记住我 [注册]