XDebug是个好东西啊,用来调试PHP程序的,可以和Eclipse配合。
配置步骤:(Windows+Apache+php环境)
1.下载和PHP版本环境相适应的XDebug版本,放置于PHP目录,主要None-ThreadSafe版似乎是用来在CLI方式下使用的,一般不需要
2.修改php.ini文件,参考如下
[Xdebug]
;zend_extension_ts?= “D:serverphp5extphp_xdebug-2.0.5-5.3-vc6.dll”
;发现在PHP5.3+Apache(CGI)方式下,似乎必须使用 zend_extension 加载才能成功
zend_extension??= “D:serverphp5extphp_xdebug-2.0.5-5.3-vc6-nts.dll”
xdebug.auto_trace??= off??;开启自动跟踪
xdebug.remote_autostart??= off??;开启远程调试自动启动
xdebug.remote_enable??= 1
xdebug.remote_host??= 10.5.184.251
xdebug.remote_port??= 9000
;xdebug.remote_handler??= “dbgp”
xdebug.show_exception_trace?= On??;开启异常跟踪
xdebug.collect_vars??= On??;收集变量
xdebug.collect_return??= On??;收集返回值
xdebug.collect_params??= On??;收集参数
注意:remote_host应该填写远程调试机的地址,而不是PHP服务器的地址,在Xdebug运行方式下,调试工具实际是调试过程的服务端,Xdebug会主动连接指定的remoete_host,从而建立调试通讯。所以要注意调试机的防火墙问题
3.配置调试工具,Eclipse就很好用,具体不说了,摸索下就可以了
4.Apaceh2下的CGI、FastCGI、Module方式都可以正常使用Xdebug
5.最新发现在PHP5.3+Apache(CGI)方式下,似乎必须使用 zend_extension 加载才能成功,而不是Zend_extension_ts