duanjiaolia97750 2017-01-04 14:48
浏览 88
已采纳

XDEBUG始终运行,不仅仅是在GET请求上运行

The title isn't my best; I was wondering how it's possible to run XDEBUG each time a script is executed on a local server, I have access to all configuration files you'd need, and I have XDEBUG for PHP running happily currently.

The only thing is it only runs when there's a GET request formed with the key of XDEBUG_PROFILE set to true, or just set, and currently with the framework I'm working on,

  1. The framework doesn't allow for extended GET requests in the URL, only slug-related data to be presented, and

  2. If I try and set $_GET['XDEBUG_PROFILE'] = true in a file on the framework, such as a Controller, the profiler gives unusual data, and creates profiles on other requests such as favicon loads and such and such, which gives awkward data to sift through.

So I thought it'd be a smart idea to be able to trigger XDEBUG on every script, just while I do development on the framework to get performance records, etc...

My current XDEBUG config in php.ini:

[XDebug]
;;;;;;;;;;;;;;;;;;

extension=php_xdebug.dll
xend_extension_ts="C:/xampp/apache/modules/php_xdebug-2.4.1-5.6-vc11.dll"

zend_extension = "\xampp\php\ext\php_xdebug.dll"
xdebug.collect_vars = 1
xdebug.show_local_vars = 1
xdebug.collect_params = 4
xdebug.remote_enable = 1
xdebug.remote_connect_back = 1

xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "\xampp\tmp\"
xdebug.profiler_output_name = "cachegrind.out.%u.%R"
xdebug.profiler_enable_trigger = 1

xdebug.remote_host=127.0.0.1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp

I tried to search this up, but the only tutorials were how to actually set up XDEBUG itself, which I've already done, I thought the changed variable would be xdebug.profiler_enable_trigger = 1, but wasn't completely sure.

Thanks in advance!

  • 写回答

1条回答 默认 最新

  • dqnek0079 2017-01-04 15:31
    关注

    Add this line to your php.ini:

    xdebug.remote_autostart = 1
    

    Normally you need to use a specific HTTP GET/POST variable to start remote debugging (see Remote Debugging). When this setting is set to 1, Xdebug will always attempt to start a remote debugging session and try to connect to a client, even if the GET/POST/COOKIE variable was not present.

    https://xdebug.org/docs/remote

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器