php - XDEBUG 始终运行,而不仅仅是在 GET 请求时

标签 php xdebug

标题不是我最好的;我想知道每次在本地服务器上执行脚本时如何运行 XDEBUG,我可以访问您需要的所有配置文件,并且我有 XDEBUG PHP 当前运行良好。

唯一的问题是它只有在 XDEBUG_PROFILE 的键设置为 true 或只是设置的 GET 请求时才会运行,目前使用的框架是我'我正在努力,

  1. 该框架不允许在 URL 中进行扩展的 GET 请求,仅显示与 slug 相关的数据,并且

  2. 如果我尝试在框架上的文件(例如 Controller)中设置 $_GET['XDEBUG_PROFILE'] = true,探查器会给出异常数据,并根据其他请求创建配置文件,例如 favicon 加载等,这会提供难以筛选的数据。

所以我认为能够在每个脚本上触发 XDEBUG 是一个聪明的想法,就在我在获取性能记录的框架等...

我当前在 php.ini 中的 XDEBUG 配置:

[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

我试图搜索它,但唯一的教程是如何实际设置 XDEBUG 本身,我已经完成了,我认为更改的变量将是 xdebug.profiler_enable_trigger = 1,但并不完全确定。

提前致谢!

最佳答案

对于 Xdebug 2.x 将此行添加到您的 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

对于 Xdebug 3.x

xdebug.start_with_request = yes

从 2.x -> 3.x 迁移时,您还必须更改其他设置,see here .例如 remote_host 被重命名为 client_host

关于php - XDEBUG 始终运行,而不仅仅是在 GET 请求时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41466661/

相关文章:

javascript - 如何将 Controller session 中的值传递到 PHP laravel View Blade ?

PHP PDO 异常 : could not find driver

phpunit --path-coverage(分支覆盖)花费 100 倍以上的时间

phpmyadmin - phpmyadmin界面上的数据库链接问题

php - 将 boolean 值转换为整数值php

php - 打印东西的简单方法,只在 while 循环内打印一次?

PHP命名空间从不同目录调用函数

php - 不用 Xdebug 生成 PHP 代码覆盖率

mamp - Xdebug 错误的 Zend API 版本号

php - sublime text 2 kindari xdebug 插件说明