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

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

报告相同问题?

悬赏问题

  • ¥30 关于#opencv#的问题:使用大疆无人机拍摄水稻田间图像,拼接成tif图片,用什么方法可以识别并框选出水稻作物行
  • ¥15 Python卡尔曼滤波融合
  • ¥20 iOS绕地区网络检测
  • ¥15 python验证码滑块图像识别
  • ¥15 根据背景及设计要求撰写设计报告
  • ¥20 能提供一下思路或者代码吗
  • ¥15 用twincat控制!
  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1