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 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题