我正在使用 Netbeans 6.7 和 XDebug 在我的机器上调试 PHP 站点,从 Netbeans (Project->Debug) 中启动请求。这工作正常,非常有用。
我的问题是:是否可以将调试器附加到任何传入的请求,而不仅仅是我从 Netbeans 中启动的请求?
即,不是单击“调试”,而是将 Netbeans 置于启动调试器并附加到下一个传入请求的模式。
我觉得这可能是一个愚蠢的问题,但如果可能的话,那就太好了。
编辑:更多信息
我的系统(Ubuntu 9.04)设置如下:
的内容/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 调试选项默认为:
Debugger Port: 9000
Session ID: netbeans-xdebug
Stop at the First Line: ticked
我的/etc/hosts
文件重定向www.mywebsite.com
到localhost
如果我单击 Netbeans 中的调试按钮,则会使用地址启动 Firefox http://www.mywebsite.com?XDEBUG_SESSION_START=netbeans-xdebug
,并且调试器按预期工作。
但是如果我只是浏览到http://www.mywebsite.com?XDEBUG_SESSION_START=netbeans-xdebug
,这不会启动 Netbeans 中的调试器。
我也尝试过设置xdebug.remote_host=www.mywebsite.com
,但这没有什么区别。
另外,我启用xdebug.remote_log
了 ,这显示了我从 netbeans 开始时的信息,但没有显示外部请求。所以我认为 XDebug 根本看不到外部请求。