如何让 NetBeans 显示带有 GET 参数的 URL 的可视化代码执行情况?

发布于 2025-01-10 17:36:25 字数 1258 浏览 1 评论 0原文

如何让 NetBeans 显示带有 GET 参数的 URL 的可视化代码执行情况?

在 NetBeans 中,我将 Xdebug 与远程服务器一起使用。效果很好。

问题是 NetBeans 的 Xdebug 仅在调试不包含 GET 参数的文件时有效。

基本上,如果我的文件名为 index.php,并且我转到 website.com/index.php?XDEBUG_SESSION_START=netbeans-debug 它就可以工作。

如果我转到 website.com/index.php?test=1&XDEBUG_SESSION_START=netbeans-debugwebsite.com/index.php?XDEBUG_SESSION_START=netbeans-debug&test=1< /code> 它运行 Xdebug,但我无法使用 NetBeans 直观地单步调试代码。

NetBeans 似乎没有意识到带有 GET 参数和没有 GET 参数的 index.php 是同一个文件,因此当我使用调试按钮单步执行代码时不会以可视方式向我显示。

我该如何解决这个问题?

使用:

  • Apache NetBeans 12.6
  • PHP 7.2
  • Xdebug 2.8.0
  • Windows 10

PHP.INI Xdebug 设置(我使用的是 SSH 隧道,因此我的 IP 是 127.0.0.1):

zend_extension=xdebug.so
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.idekey=netbeans-debug
xdebug.mode=develop,coverage,debug,gcstats,profile,trace
xdebug.remote_log="xdebug_remote_log.txt"

谢谢!

PS:我无法使用 VSCode 或 PHPStorm,因为我使用的是 Namecheap 共享托管,因此这两个工具都不起作用。

How do I get NetBeans to show visual code execution for URL with GET parameters?

In NetBeans I am using Xdebug with a remote server. That is working fine.

The problem is Xdebug with NetBeans only works when debugging files that don't contain GET parameters.

Basically if my file is called index.php, and I go to website.com/index.php?XDEBUG_SESSION_START=netbeans-debug It works.

If I go to website.com/index.php?test=1&XDEBUG_SESSION_START=netbeans-debug or website.com/index.php?XDEBUG_SESSION_START=netbeans-debug&test=1 it runs Xdebug, but I can't step through the code visually with NetBeans.

It seems NetBeans doesn't realize that index.php with GET parameters and no GET parameters is a the same file, and thus doesn't show me visually as I step through the code with the debug buttons.

How do I fix this?

Using:

  • Apache NetBeans 12.6
  • PHP 7.2
  • Xdebug 2.8.0
  • Windows 10

PHP.INI settings for Xdebug (I am using SSH tunnel hence why my IP is 127.0.0.1):

zend_extension=xdebug.so
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_mode=req
xdebug.idekey=netbeans-debug
xdebug.mode=develop,coverage,debug,gcstats,profile,trace
xdebug.remote_log="xdebug_remote_log.txt"

Thanks!

P.S: I can't use VSCode, or PHPStorm as I am using Namecheap shared hosting, so both those tools don't work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七婞 2025-01-17 17:36:25

Apache Netbeans 12.6、PHP 7.2、Xdebug 2.8.0、Windows 10

需要升级,Xdebug 2 和 PHP 7.2 为 不再支持

当您将 Xdebug 3 设置 (xdebug.mode) 与 Xdebug 2 设置(其他设置)混合在一起时,您的设置也没有意义。


回到您的问题:使用 GET/POST 参数启动调试会话几乎已被弃用。相反,您可以使用浏览器扩展来触发调试请求,同时您的 IDE 会侦听传入的调试请求。不幸的是,这不是 Netbeans 支持的。请不要使用 Netbeans 进行调试,因为它远远落后于 VS Code 和 PhpStorm 等其他 IDE。

Apache Netbeans 12.6, PHP 7.2, Xdebug 2.8.0, Windows 10

You need to upgrade, Xdebug 2 and PHP 7.2, are no longer supported.

Your settings also don't make sense, as you mix Xdebug 3 settings (xdebug.mode) with Xdebug 2 settings (the others).


To get back to your question: using GET/POST parameters to start a debugging session is pretty much deprecated. Instead, you can use a browser extension to trigger debugging requests, while your IDE listens for incoming debugging requests. Unfortunately, this is not something that Netbeans supports. Please don't use Netbeans for debugging, as it is so far behind other IDEs such as VS Code and PhpStorm.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文