在外部请求下在Netbeans中启动XDebug [英] Launch XDebug in Netbeans on an external request
问题描述
我正在使用Netbeans 6.7和XDebug在我的机器上调试一个PHP站点,从Netbeans内部启动请求(Project-> Debug).这样可以很好地工作,并且非常有用.
I'm using Netbeans 6.7 and XDebug to debug a PHP site on my machine, launching the request from within Netbeans (Project->Debug). This works fine, and is very useful.
我的问题是:是否可以将调试器附加到传入的任何请求中,而不仅仅是我从Netbeans中启动的那些请求?
My question is: Is it possible to attach the debugger to any request that comes in, rather just those I launch from within Netbeans?
ie,而不是单击调试",而是将Netbeans置于启动调试器并附加到下一个传入请求的模式.
ie, instead of clicking "Debug", put Netbeans into a mode whereby the debugger is launched and attaches to the next request that comes in.
我觉得这可能是一个愚蠢的问题,但是如果可能的话,那就太好了.
I have a feeling this may be a stupid question, but if it is possible, that'd be great.
修改:更多信息
我的系统(Ubuntu 9.04)设置如下:
My system (Ubuntu 9.04) is set up as follows:
/etc/php5/conf.d/xdebug.ini
zend_extension=/usr/lib/php5/20060613/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=netbeans-xdebug
Netbeans PHP调试选项为默认设置:
Netbeans PHP debugging options are at the defaults:
Debugger Port: 9000
Session ID: netbeans-xdebug
Stop at the First Line: ticked
我的/etc/hosts
文件将www.mywebsite.com
重定向到localhost
如果我单击Netbeans中的调试按钮,则会使用地址http://www.mywebsite.com?XDEBUG_SESSION_START=netbeans-xdebug
启动Firefox,并且调试器将按预期工作.
If I click on the debug button in Netbeans, then Firefox is launched with the address http://www.mywebsite.com?XDEBUG_SESSION_START=netbeans-xdebug
, and the debugger works as expected.
但是,如果我只是浏览到http://www.mywebsite.com?XDEBUG_SESSION_START=netbeans-xdebug
,则不会启动Netbeans中的调试器.
But if I just browse to http://www.mywebsite.com?XDEBUG_SESSION_START=netbeans-xdebug
, this doesn't start the debugger in Netbeans.
我也尝试设置xdebug.remote_host=www.mywebsite.com
,但这没什么区别.
I've also tried setting xdebug.remote_host=www.mywebsite.com
, but that makes no difference.
此外,我启用了xdebug.remote_log
,它显示的是我从netbeans中启动时的信息,但对于外部请求则没有任何信息.因此,我认为XDebug根本看不到外部请求.
Also, I've enabled xdebug.remote_log
, and that's showing information for when I start from within netbeans, but nothing for external requests. So I don't think XDebug is seeing the external requests at all.
推荐答案
转到项目属性> 运行配置> 高级> 调试网址,然后选中不要打开网络浏览器(*). not 不在 debugger proxy 下设置主机.保存这些设置.在项目窗口中的项目上:右键单击> 调试(这将开始侦听调试连接).没有启动浏览器.在浏览器中输入http://www.mywebsite.com?XDEBUG_SESSION_START=netbeans-xdebug
.它应该打破netbeans.至少那是这里发生的事情:)
go to project properties > run configuration > advanced > debug url and check do not open web browser (*). do not set the host under debugger proxy. save these settings. in the project window, on your project: right mouse click > debug (this starts listening for debug connections). no browser is started. enter http://www.mywebsite.com?XDEBUG_SESSION_START=netbeans-xdebug
in your browser. it should break in netbeans. at least that's what happens here :)
(*),您可能还需要设置一个路径映射-对我来说,它无需使用即可
(*) you might also have to set a path mapping - for me, it works without
这篇关于在外部请求下在Netbeans中启动XDebug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!