xdebug3 设置翻译中,欢迎参与

前提

  • PHP 到了 8.0 后 xdebug 也到了版本3
  • xdebug3 英文
  • 虽然有英文版本可以看,但是翻译成中文版本看就不用那么吃力了
  • 进行中,欢迎提交改进翻译
  • 应该用先进的 xdebug 比手动 dump 更有效率

正文

这部分给出所有 Xdebug 的变量设置

除非特别提到,每种设置可以在 php.ini, 或者在像 99-xdebug.ini 这样的文件, 同样也可以在 Apache’s .htaccess 和 PHP-FPM’s .user.ini 这样的文件中设置.

XDEBUG_CONFIG 环境变量 #

可通过以下方式设置一组: XDEBUG_CONFIG 环境变量. 在这种情况下, 在 xdebug. 中如果有设置相应的名称应该删除. 这方面的一个例子是:

export XDEBUG_CONFIG="client_host=192.168.42.34 log=/tmp/xdebug.log"

下面说明文档每个设置 XDEBUG_CONFIG.是否可行

一些web服务器有一个配置选项,可以防止环境变量传播到PHP和Xdebug。

例如, PHP-FPM 有一个 clear_env 默认设置 , 如果你想设置 XDEBUG_CONFIG 你得返回 off .

确保你的服务器没有清除环境,或者特别允许 XDEBUG_CONFIG这个变量被传递下去


类型 名称 = 值

integer xdebug.cli_color = 0 #

如果设置为 1 , 则Xdebug将在CLI模式下和输出为tty时为var_dumps和堆栈跟踪输出着色,在Windows上, 需要安装ANSICON工具

如果设置为 2,则Xdebug将始终为var_dumps和堆栈跟踪着色,无论它是连接到tty还是安装了ANSICON。在这种情况下,您最终可能会看到转义码

查看文章 了解更多信息.

这个配置可以追加到 XDEBUG_CONFIG 环境变量.


string xdebug.client_discovery_header = “” #

如果 xdebug.client_discovery_header 不为空字符, 当这个值被作为键使用在 $_SERVER 全局数组去决定 header 去查找 IP 地址或者 hostname 去作为’连接返回’.

这个设置只有通过结合 xdebug.discover_client_host 否则被忽略.

例子, 如果 xdebug.client_discovery_header 设置为 FORWARD_HOST, Xdebug 将会检查 $_SERVER['FORWARD_HOST']在这个 $_SERVER['HTTP_X_FORWARDED_FOR']$_SERVER['REMOTE_ADDR'] 变量之前.


string xdebug.client_host = localhost #

启动调试连接时, Xdebug 将尝试连接到的 IP 地址或者 hostname 名称. 此地址应该是 IDE 或调试客户端正在侦听传入调试连接的计算机的地址.

在非Windows平台上,只有“选择视图”调试客户端还可以配置 Unix domain socket . 在这种情况下,使用 unix:///path/to/sock 代替主机名或IP地址.

如果 Xdebug 连接到IDE 时 HTTP header信息无法使用,如果xdebug.discover_client_host设置了, 则Xdebug将仅使用此设置的值.在这种情况下,此设置的值仅用作返回.

这个配置可以追加到 XDEBUG_CONFIG environment variable.


integer xdebug.client_port = 9003 #

Xdebug试图在远程主机上连接的端口. Xdebug 和 命令行调试客户端9003 作为默认端口. 由于许多客户端使用此端口号,因此最好保持此设置不变。

这个配置可以追加到 XDEBUG_CONFIG environment variable.


string xdebug.cloud_id = #

通过此设置,您可以配置Xdebug以与 Xdebug Cloud一起使用. 他需要你的 profile page 配置一个token.

你的 IDE 需要配置同样的 token 给你的 Xdebug 和 IDE 来允许通过 Xdebug Cloud通信

在 PhpStorm 中你可以通过下面路径设置

File | Settings | PHP | Debug | Xdebug Cloud for Windows and Linux
PhpStorm | Preferences | PHP | Debug | Xdebug Cloud for macOS


boolean xdebug.collect_assignments = false #

这个设置默认值 0, 控制Xdebug是否应向函数跟踪添加变量赋值。. 也包括 Assign-by-var (=&) 赋值


boolean xdebug.collect_return = false #

这个设置默认值 0, 控制Xdebug是否应将函数调用的返回值写入跟踪文件.


integer xdebug.connect_timeout_ms = 200 #

Xdebug在IDE上等待确认传入调试连接的时间(以毫秒为单位). 在大多数情况下,200毫秒的默认值应该足够了. 如果调试请求经常被丢弃,可能是因为您有一个高延迟的网络,或者开发环境远离IDE,或者防火墙速度较慢,那么您可以增加这个值.

请注意,如果Xdebug试图建立连接,但您的IDE没有监听,那么增加该值可能意味着您的请求似乎“挂起”。


boolean xdebug.discover_client_host = false #

如果启用, Xdebug将首先尝试连接到发出HTTP请求的客户端. 将会检查 $_SERVER['HTTP_X_FORWARDED_FOR']$_SERVER['REMOTE_ADDR'] 变量决定使用的 hostname 或者 IP 地址.

如果 xdebug.client_discovery_header 配置了, 接下来 将在“HTTP_X_FORWARDED_FOR”和“REMOTE_ADDR”之前检查具有该配置名称的$_SERVER 变量.

如果Xdebug无法连接到某个HTTP头中的调试客户端, 它将返回到xdebug配置 xdebug.client_host 的主机名或IP地址。

这个配置不支持命令行调试, $_SERVER请求头变量在这里是不可用的

这个配置可以追加到 XDEBUG_CONFIG environment variable.

请注意当没有过滤用户时, 任何人都可以连接到Web服务器的人都可以启动调试会话, 即使设置的 xdebug.client_host 不匹配.


string xdebug.dump.* = Empty #

* can be any of COOKIE, FILES, GET, POST, REQUEST, SERVER, SESSION. 这七个设置控制在出现错误情况时显示全局变量的哪些数据。

每一个 php.ini 设置可以由一个逗号分隔的变量列表组成,这些列出变量将从全局变量打印出来,或者为所有这些文件设置“*”。确保不在此设置中添加空格.

为了在发生错误时打印 REMOTE_ADDRREQUEST_方法,以及所有GET参数,请添加这些设置:

xdebug.dump.SERVER = REMOTE_ADDR,REQUEST_METHOD
xdebug.dump.GET = *

boolean xdebug.dump_globals = true #

当这个设置为 true, Xdebug 添加全局变量值作为配置通过 xdebug.dump.* 打印到屏幕上的堆栈跟踪和错误日志 (如果启用).


boolean xdebug.dump_once = true #

控制是否应在所有错误情况下全局变量是否被打印 (设置 0) 或者只在第一次 (设置 1).


boolean xdebug.dump_undefined = false #

如果你想从全局变量打印 undefined 的值时你应该设置为 1, 否则将其设置为0。


string xdebug.file_link_format = #

此设置确定在使用文件名的堆栈跟踪显示中创建的链接的格式. 这允许IDE设置一个链接协议,通过单击Xdebug在堆栈跟踪中显示的文件名,可以直接转到行和文件。示例格式可能如下所示:

myide://%f@%l

可能的格式说明符有:

Specifier Meaning
%f 文件名
%l 行数

对于各种IDE/OSS,有一些关于如何实现这一点的说明:

Firefox on Linux

  • 打开about:config

  • 添加一个布尔设置 “network.protocol-handler.expose.xdebug” 然后设置为 “false”

  • 将以下内容添加到shell脚本中

  ~/bin/ff-xdebug.sh

:

  #! /bin/sh

  f=`echo $1 | cut -d @ -f 1 | sed 's/xdebug:\/\///'`
  l=`echo $1 | cut -d @ -f 2`

Add to that one of (depending whether you have komodo, gvim or netbeans):

  • komodo $f -l $l
  • gvim --remote-tab +$l $f
  • netbeans "$f:$l"
  • Make the script executable with chmod +x ~/bin/ff-xdebug.sh

  • Set the xdebug.file_link_format setting to xdebug://%f@%l

Windows and netbeans

  • Create the file

    netbeans.bat

and save it in your path (

  C:\Windows

will work):

  @echo off
  setlocal enableextensions enabledelayedexpansion
  set NETBEANS=%1
  set FILE=%~2
  %NETBEANS% --nosplash --console suppress --open "%FILE:~19%"
  nircmd win activate process netbeans.exe

Note: Remove the last line if you don’t have nircmd.

  • Save the following code as
  netbeans_protocol.reg

:

  Windows Registry Editor Version 5.00

  [HKEY_CLASSES_ROOT\netbeans]
  "URL Protocol"=""
  @="URL:Netbeans Protocol"

  [HKEY_CLASSES_ROOT\netbeans\DefaultIcon]
  @="\"C:\\Program Files\\NetBeans 7.1.1\\bin\\netbeans.exe,1\""

  [HKEY_CLASSES_ROOT\netbeans\shell]

  [HKEY_CLASSES_ROOT\netbeans\shell\open]

  [HKEY_CLASSES_ROOT\netbeans\shell\open\command]
  @="\"C:\\Windows\\netbeans.bat\" \"C:\\Program Files\\NetBeans 7.1.1\\bin\\netbeans.exe\" \"%1\""

Note: Make sure to change the path to Netbeans (twice), as well as the netbeans.bat batch file if you saved it somewhere else than C:\Windows\.

  • Double click on the netbeans_protocol.reg file to import it into the registry.

  • Set the xdebug.file_link_format setting to xdebug.file_link_format = "netbeans://open/?f=%f:%l"


string xdebug.filename_format = …%s%n #

此设置确定Xdebug在HTML堆栈跟踪中呈现文件名的格式(默认: ...%s%n) 然后本地信息通过加载 xdebug_var_dump() (默认: %f).

此表中列出了可能的格式说明符. 根据完整路径呈现示例输出/var/www/vendor/mail/transport/mta.php.

Specifier Meaning Example Output
%a Ancester: 两个目录元素和文件名 mail/transport/mta.php
%f 全路径 /var/www/vendor/mail/transport/mta.php
%n Name: 只能是文件名 mta.php
%p Parent: 只能是目录和文件 transport/mta.php
%s / on Linux, OSX and other Unix-like systems, \ on Windows

integer xdebug.force_display_errors = 0 #

如果设置为 1 错误总被打印, 无论 PHP display_errors 设置什么.


integer xdebug.force_error_reporting = 0 #

此设置是位掩码, 像 error_reporting. 此位掩码将与错误表示的位掩码进行逻辑或运算,error_reporting 向dermine报告应显示哪些错误. 此设置只能在 php.ini 设置并允许您强制显示某些错误,无论应用程序ini_set()设置了什么 .


string xdebug.gc_stats_output_name = gcstats.%p #

这个设置决定 gc 垃圾收集信息打印到文件名中,该设置使用格式说明符指定格式, 很像 sprintf()strftime().

有几个格式说明符可用于格式化文件名。

查看 xdebug.trace_output_name 支持的说明符的文档


integer xdebug.halt_level = 0 #

此设置允许您配置一个掩码,以确定 whether, which, notices 和/或 warnings 会转换为错误. 您可以配置由PHP生成的通知和警告,以及您自己生成的通知和警告(通过trigger_error()).

例如,要将strlen() 方法的警告(无参数)转换为错误,可以执行以下操作:

ini_set('xdebug.halt_level', E_WARNING);
strlen();
echo "Hi!\n";

这将导致显示错误消息,并终止脚本echo "Hi!\n";不会执行。

该设置是一个位掩码,所以要将所有应用程序的所有 noticeswarnings 转换为错误,可以在 php.ini 中设置:

xdebug.halt_level=E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE

位掩码仅支持上述四个级别。

string xdebug.idekey = complex #

Controls which IDE Key Xdebug should pass on to the debugging client or proxy. The IDE Key is only important for use with the DBGp Proxy Tool, although some IDEs are incorrectly picky as to what its value is.

The default is based on the DBGP_IDEKEY environment setting. If it is not present, the default falls back to an empty string.

If this setting is set to a non-empty string, it selects its value over DBGP_IDEKEY environment variable as default value.

The internal IDE Key also gets updated through debugging session management and overrides the value of this setting as is explained in the Step Debugging documentation.

This setting can additionally be configured through the XDEBUG_CONFIG environment variable.


string xdebug.log = #

Configures Xdebug’s log file.

Xdebug will log to this file all file creations issues, Step Debugging connection attempts, failures, and debug communication.

Enable this functionality by setting the value to a absolute path. Make sure that the system user that PHP runs at (such as www-data if you are running with Apache) can create and write to the file.

The file is opened in append-mode, and will therefore not be overwritten by default. There is no concurrency protection available.

The log file will include any attempt that Xdebug makes to connect to an IDE:

[2693358] Log opened at 2020-09-02 07:19:09.616195
[2693358] [Step Debug] INFO: Connecting to configured address/port: localhost:9003.
[2693358] [Step Debug] ERR: Could not connect to debugging client. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).
[2693358] [Profiler] ERR: File '/foo/cachegrind.out.2693358' could not be opened.
[2693358] [Profiler] WARN: /foo: No such file or directory
[2693358] [Tracing] ERR: File '/foo/trace.1485761369' could not be opened.
[2693358] [Tracing] WARN: /foo: No such file or directory
[2693358] Log closed at 2020-09-02 07:19:09.617510

It includes the opening time (2020-09-02 07:19:09.616195), the IP/Hostname and port Xdebug is trying to connect to (localhost:9003), and whether it succeeded (Connected to client). The number in brackets ([2693358]) is the Process ID.

It includes:

  • [2693358]

    process ID in brackets

  • 2020-09-02 07:19:09.616195

    opening time

For Step Debugging:

INFO: Connecting to configured address/port: localhost:9003.
ERR: Could not connect to debugging client. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port).

For Profiling:

ERR: File '/foo/cachegrind.out.2693358' could not be opened.
WARN: /foo: No such file or directory

For Function Trace:

ERR: File '/foo/trace.1485761369' could not be opened.
WARN: /foo: No such file or directory

All warnings and errors are described on the Description of errors page, with detailed instructions on how to resolve the problem, if possible. All errors are always logged through PHP’s internal logging mechanism (configured with error_log in php.ini). All warnings and errors also show up in the diagnostics log that you can view by calling xdebug_info().

Step Debugger Communication

The debugging log can also log the communication between Xdebug and an IDE. This communication is in XML, and starts with the ` XML element:

<init
    xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug"
    fileuri="file:///home/httpd/www.xdebug.org/html/router.php"
    language="PHP" xdebug:language_version="7.4.11-dev"
    protocol_version="1.0" appid="2693358" idekey="XDEBUG_ECLIPSE">
        <engine version="3.0.0-dev"><![CDATA[Xdebug]]></engine>
        <author><![CDATA[Derick Rethans]]></author>
        <url><![CDATA[https://xdebug.org]]></url>
        <copyright><![CDATA[Copyright (c) 2002-2020 by Derick Rethans]]></copyright>
</init>

The fileuri attribute lists the entry point of your application, which can be useful to compare to breakpoint_set commands to see if path mappings are set-up correctly.

Beyond the ` element, you will find the configuration of features:

<- feature_set -i 4 -n extended_properties -v 1
-> <response
       xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug"
       command="feature_set" transaction_id="4" feature="extended_properties" success="1">
   </response>

And continuation commands:

<- step_into -i 9
-> <response
       xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug"
       command="step_into" transaction_id="9"
       status="break" reason="ok">
           <xdebug:message filename="file:///home/httpd/www.xdebug.org/html/router.php" lineno="3">
           </xdebug:message>
   </response>

You can read about DBGP - A common debugger protocol specification at its dedicated documation page.

The xdebug.log_level setting controls how much information is logged.

Many Linux distributions now use systemd, which implements private tmp directories. This means that when PHP is run through a web server or as PHP-FPM, the /tmp directory is prefixed with something akin to:

/tmp/systemd-private-ea3cfa882b4e478993e1994033fc5feb-apache.service-FfWZRg

This setting can additionally be configured through the XDEBUG_CONFIG environment variable.


integer xdebug.log_level = 7 #

Configures which logging messages should be added to the log file.

The log file is configured with the xdebug.log setting.

The following levels are supported:

Level Name Example
0 Criticals Errors in the configuration
1 Errors Connection errors
3 Warnings Connection warnings
5 Communication Protocol messages
7 Information Information while connecting
10 Debug Breakpoint resolving information

Criticals, errors, and warnings always show up in the diagnostics log that you can view by calling xdebug_info().

Criticals and errors are additionally logged through PHP’s internal logging mechanism (configured with error_log in php.ini).

This setting can additionally be configured through the XDEBUG_CONFIG environment variable.


integer xdebug.max_nesting_level = 256 #

Controls the protection mechanism for infinite recursion protection. The value of this setting is the maximum level of nested functions that are allowed before the script will be aborted.

When the maximum nesting level is reached, an “Error“ exception is thrown.


integer xdebug.max_stack_frames = -1 #

Controls how many stack frames are shown in stack traces, both on the command line during PHP error stack traces, as well as in the browser for HTML traces.


string xdebug.mode = develop #

This setting controls which Xdebug features are enabled.

This setting can only be set in php.ini or files like 99-xdebug.ini that are read when a PHP process starts (directly, or through php-fpm), but not in .htaccess and .user.ini files, which are read per-request.

The following values are accepted:

  • off

    Nothing is enabled. Xdebug does no work besides checking whether functionality is enabled. Use this setting if you want close to 0 overhead.

  • develop

    Enables Development Helpers including the overloaded var_dump().

  • coverage

    Enables Code Coverage Analysis to generate code coverage reports, mainly in combination with PHPUnit.

  • debug

    Enables Step Debugging. This can be used to step through your code while it is running, and analyse values of variables.

  • gcstats

    Enables Garbage Collection Statistics to collect statistics about PHP’s Garbage Collection Mechanism.

  • profile

    Enables Profiling, with which you can analyse performance bottlenecks with tools like KCacheGrind.

  • trace

    Enables the Function Trace feature, which allows you record every function call, including arguments, variable assignment, and return value that is made during a request to a file.

You can enable multiple modes at the same time by comma separating their identifiers as value to xdebug.mode: xdebug.mode=develop,trace.

XDEBUG_MODE environment variable

You can also set Xdebug’s mode by setting the XDEBUG_MODE environment variable on the command-line; this will take precedence over the xdebug.mode setting, but will not change the value of the xdebug.mode setting.

Some web servers have a configuration option to prevent environment variables from being propagated to PHP and Xdebug.

For example, PHP-FPM has a clear_env configuration setting that is on by default, which you will need to turn off if you want to use XDEBUG_MODE.

Make sure that your web server does not clean the environment, or specifically allows the XDEBUG_MODE environment variable to be passed on.


string xdebug.output_dir = /tmp #

The directory where Xdebug will write tracing, profiling, and garbage collection statistics to. This directory needs to be writable for the system user with which PHP is running.

This setting can be changed in php.ini, .htaccess (and equivalent files), and within a PHP file with ini_set().

In some cases (when profiling, or when xdebug.start_with_request=yes with tracing), Xdebug creates the file before the script runs. In that case, changes made through ini_set() will not be taken into account.

This setting can additionally be configured through the XDEBUG_CONFIG environment variable.


integer xdebug.profiler_append = 0 #

When this setting is set to 1, profiler files will not be overwritten when a new request would map to the same file (depending on the xdebug.profiler_output_name setting. Instead the file will be appended to with the new profile.


string xdebug.profiler_output_name = cachegrind.out.%p #

This setting determines the name of the file that is used to dump traces into. The setting specifies the format with format specifiers, very similar to sprintf() and strftime(). There are several format specifiers that can be used to format the file name.

See the xdebug.trace_output_name documentation for the supported specifiers.

This setting can additionally be configured through the XDEBUG_CONFIG environment variable.


boolean xdebug.scream = false #

If this setting is 1, then Xdebug will disable the @ (shut-up) operator so that notices, warnings and errors are no longer hidden.


integer xdebug.show_error_trace = 0 #

When this setting is set to 1, Xdebug will show a stack trace whenever an Error is raised - even if this Error is actually caught.


integer xdebug.show_exception_trace = 0 #

When this setting is set to 1, Xdebug will show a stack trace whenever an Exception or Error is raised - even if this Exception or Error is actually caught.

Error ‘exceptions’ were introduced in PHP 7.


integer xdebug.show_local_vars = 0 #

When this setting is set to something != 0 Xdebug’s generated stack dumps in error situations will also show all variables in the top-most scope. Beware that this might generate a lot of information, and is therefore turned off by default.


string xdebug.start_upon_error = default #

Step Debugging can be activated when a PHP Notice or Warning is emitted, or when a Throwable (Exception/Error) is thrown, depending on the value of this setting:

  • yes

    Initialise a debugging session when a PHP Notice or Warning is emitted, or when a Throwable is thrown.

  • no

  • default

    Do not start a debugging session upon an error situation.


string xdebug.start_with_request = default #

A Function Trace, Garbage Collection Statistics, Profiling, or Step Debugging can be activated at the start of a PHP request. Whether this happens depends on the value of this setting:

  • yes

    The functionality starts when the PHP request starts, and before any PHP code is run.For example xdebug.mode=trace and xdebug.start_with_request=yes starts a Function Trace for the whole request.

  • no

    The functionality does not get activated when the request starts.You can still start a Function Trace with xdebug_start_trace(), Step Debugging with xdebug_break(), or Garbage Collection Statistics with xdebug_start_gcstats().

  • trigger

    The functionality only gets activated when a specific trigger is present when the request starts.The name of the trigger is XDEBUG_TRIGGER, and Xdebug checks for its presence in either $_ENV (environment variable), $_GET or $_POST variable, or $_COOKIE (HTTP cookie name).There is a legacy fallback to a functionality specific trigger name: XDEBUG_PROFILE (for Profiling), XDEBUG_TRACE (for a Function Trace), and XDEBUG_SESSION (for Step Debugging).There is another legacy trigger. If you set the XDEBUG_CONFIG environment variable to any value, then Xdebug will also get activated.Debug session management for Step Debugging is also available through XDEBUG_SESSION_START.With xdebug.trigger_value you can control which specific trigger value will activate the trigger. If xdebug.trigger_value is set to an empty string, any value will be accepted.

  • default

    The default value depends on xdebug.mode:debug: triggergcstats: noprofile: yestrace: trigger


integer xdebug.trace_format = 0 #

The format of the trace file.

Value Description
0 shows a human readable indented trace file with: time index, memory usage, memory delta, level, function name, function parameters, filename and line number.
1 writes a computer readable format which has two different records. There are different records for entering a stack frame, and leaving a stack frame. The table below lists the fields in each type of record. Fields are tab separated.
2 writes a trace formatted in (simple) HTML.

Fields for the computerized format:

Record type 1 2 3 4 5 6 7 8 9 10 11 12 - …
Entry level function # always ‘0’ time index memory usage function name user-defined (1) or internal function (0) name of the include or require file filename line number no. of arguments arguments (as many as specified in field 11) - tab separated
Exit level function # always ‘1’ time index memory usage empty
Return level function # always ‘R’ empty return value empty

See the introduction for Function Trace for a few examples.


integer xdebug.trace_options = 0 #

When set to ‘1’ the trace files will be appended to, instead of being overwritten in subsequent requests.


string xdebug.trace_output_name = trace.%c #

This setting determines the name of the file that is used to dump traces into. The setting specifies the format with format specifiers, very similar to sprintf() and strftime(). There are several format specifiers that can be used to format the file name. The ‘.xt’ extension is always added automatically.

The possible format specifiers are:

Specifier Meaning Example Format Example Filename
%c crc32 of the current working directory trace.%c trace.1258863198.xt
%p pid trace.%p trace.5174.xt
%r random number trace.%r trace.072db0.xt
%s script name 2 cachegrind.out.%s cachegrind.out._home_httpd_html_test_xdebug_test_php
%t timestamp (seconds) trace.%t trace.1179434742.xt
%u timestamp (microseconds) trace.%u trace.1179434749_642382.xt
%H $_SERVER[‘HTTP_HOST’] trace.%H trace.kossu.xt
%R $_SERVER[‘REQUEST_URI’] trace.%R trace._test_xdebug_test_php_var=1_var2=2.xt
%U $_SERVER[‘UNIQUE_ID’] 3 trace.%U trace.TRX4n38AAAEAAB9gBFkAAAAB.xt
%S session_id (from $_COOKIE if set) trace.%S trace.c70c1ec2375af58f74b390bbdd2a679d.xt
%% literal % trace.%% trace.%%.xt

2 This one is only available for trace file names since Xdebug 2.6.

3 New in version 2.2. This one is set by Apache’s mod_unique_id module


string xdebug.trigger_value = “” #

This setting can be used when xdebug.start_with_request is set to trigger, which is the default for Step Debugging and Function Trace.

In trigger mode, Xdebug will only start its functionality when the XDEBUG_TRIGGER is set in the environment, or when the XDEBUG_TRIGGER GET, POST, or COOKIE variable is set.

The legacy names XDEBUG_SESSION (for Step Debugging), XDEBUG_PROFILE (for Profiling), and XDEBUG_TRACE (for Function Trace) can also be used instead of XDEBUG_TRIGGER.

Normally, Xdebug does not look at which value is actually used. If this setting is set to a non-empty string, then Xdebug will only trigger if the value matches the value of this setting.

With the following settings:

xdebug.mode=profile
xdebug.start_with_request=trigger
xdebug.trigger_value=StartProfileForMe

Xdebug’s profiler will only start when either the environment variable XDEBUG_TRIGGER is set to StartProfileForMe, the GET or POST variable XDEBUG_TRIGGER is set to StartProfileForMe, or when the cookie XDEBUG_TRIGGER has the value StartProfileForMe.

From Xdebug 3.1, it is possible to configure multiple values by using a comma separated list. In that case, Xdebug will trigger if the supplied value matches any of the entries that are configured through this setting:

xdebug.trigger_value=StartDebuggerForMe,StartDebuggerForYou

See also:


boolean xdebug.use_compression = true #

Introduced in Xdebug >= 3.1

If enabled, the Function Trace and Profiling features will create GZip compressed files as output. This reduces diskspace.

If GZip compression is not supported by Xdebug, because it was not compiled in, then Xdebug will add a warning to its log and xdebug_info() diagnostics section.

It is enabled by default if Xdebug has GZip support, and disable if Xdebug does not have GZip support.

The QCacheGrind tool that you can use to visualise profiling information does not support reading GZip compressed profile files, whereas KCacheGrind and PhpStorm do. If you are a QCacheGrind user, you should set xdebug.use_compression to false.


integer xdebug.var_display_max_children = 128 #

Controls the amount of array children and object’s properties are shown when variables are displayed with either xdebug_var_dump(), xdebug.show_local_vars or when making a Function Trace.

To disable any limitation, use -1 as value.

This setting does not have any influence on the number of children that is send to the client through the Step Debugging feature.


integer xdebug.var_display_max_data = 512 #

Controls the maximum string length that is shown when variables are displayed with either xdebug_var_dump(), xdebug.show_local_vars or when making a Function Trace.

To disable any limitation, use -1 as value.

This setting does not have any influence on the number of children that is send to the client through the Step Debugging feature.


integer xdebug.var_display_max_depth = 3 #

Controls how many nested levels of array elements and object properties are when variables are displayed with either xdebug_var_dump(), xdebug.show_local_vars or when making a Function Trace.

The maximum value you can select is 1023. You can also use -1 as value to select this maximum number.

This setting does not have any influence on the number of children that is send to the client through the Step Debugging feature.

Setting the value to a high number could potentially result in PHP using up all the available memory, so use with caution.

本作品采用《CC 协议》,转载必须注明作者和本文链接
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
讨论数量: 1

file

这里可以创建文档

2年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!