【问题标题】:PHP Netbeans breakpoints only hit for requests from debug session initiated browserPHP Netbeans 断点仅针对来自调试会话启动的浏览器的请求
【发布时间】:2015-01-24 21:56:51
【问题描述】:

我正在调试一个 PHP codeigniter 项目,其中有一个控制器方法可以读取 php://input 并从中获取数据。我在那里放了一个断点,如果我通过浏览器请求该方法(由 netbeans 调试启动),它将成功命中。我有另一个将数据发送到相同方法的 JAVA 应用程序。我需要的是捕捉它。但是 java 应用程序发起的请求不会命中 netbeans 断点。反正我能做到这一点吗?提前致谢。

zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_mode = "req"
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port = 9000
xdebug.trace_output_dir = "C:\xampp\tmp"

【问题讨论】:

    标签: php codeigniter netbeans xdebug


    【解决方案1】:

    经过一些研究和调整,我能够配置它。首先你需要添加

    xdebug.remote_autostart = 1
    xdebug.idekey = "netbeans-xdebug"
    

    到 php.ini 自动启动调试会话而不使用XDEBUG_SESSION_START=netbeans-xdebug 和 Netbeans 默认只听上面的 ide 键。

    然后您应该在项目属性 -> 运行配置 -> 高级中启用不要打开 Web 浏览器。我不需要路径映射(我启用了将文件复制到服务器的选项)。现在断点应该命中任何源发起的请求(对于我来说是 Firefox、Chrome 和我的 Java 应用程序)。

    参考:

    Stackoverflow Question

    Xdebug docs

    【讨论】:

      猜你喜欢
      • 2017-01-27
      • 2013-07-09
      • 1970-01-01
      • 2011-10-21
      • 2023-03-10
      • 2018-08-10
      • 2017-05-07
      • 1970-01-01
      • 2010-11-27
      相关资源
      最近更新 更多