根据外部请求在 Netbeans 中启动 XDebug

Launch XDebug in Netbeans on an external request(根据外部请求在 Netbeans 中启动 XDebug)
本文介绍了根据外部请求在 Netbeans 中启动 XDebug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在使用 Netbeans 6.7 和 XDebug 在我的机器上调试 PHP 站点,从 Netbeans 内启动请求(项目->调试).这很好用,而且非常有用.

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?

即,不是单击调试",而是将 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

My /etc/hosts file redirects www.mywebsite.com to localhost

如果我单击 Netbeans 中的调试按钮,Firefox 将使用地址 http://www.mywebsite.com?XDEBUG_SESSION_START=netbeans-xdebug 启动,并且调试器按预期工作.

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.

推荐答案

转到项目属性 > 运行配置 > 高级 > 调试网址并检查不要打开网络浏览器 (*).不要调试器代理下设置主机.保存这些设置.在项目窗口中,在您的项目上:鼠标右键单击 > 调试(这将开始侦听调试连接).没有启动浏览器.在浏览器中输入 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)