且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Xdebug: [Step Debug] 无法连接到调试客户端.试过: localhost:9003(通过 xdebug.client_host/xdebug.client_port 回退):-(

更新时间:2022-05-15 21:48:50

首先是什么导致了该消息:

您有 xdebug.start_with_request = yes(与 Xdebug v2 的 xdebug.remote_autostart = yes 相同).此选项告诉 Xdebug 尝试调试每个请求/脚本,而不管debug me"标志.

What causes that message in the first place:

You have xdebug.start_with_request = yes (which is the same as xdebug.remote_autostart = yes for Xdebug v2). This option tells Xdebug to try to debug every single request/script regardless of the "debug me" flag.

如果 Xdebug 无法连接到调试客户端(来自 xdebug.client_host & xdebug.client_port 的值...或自动检测到的主机,如果 xdebug.discover_client_host 已启用)然后它会通知您.

If Xdebug fails to connect to the debug client (values from xdebug.client_host & xdebug.client_port .. or autodetected host if xdebug.discover_client_host is enabled) then it notifies you about that.

Xdebug 使用标准 PHP 例程来编写此类警告(例如 标准 PHP error_log() 函数).通常这样的消息会被写入标准的PHP的错误日志.看起来您的 php.ini(空值)中根本没有配置它,因此 PHP 将它发送到您的标准输出(因此您仍然可以看到它,因为它可能重要).

Xdebug uses standard PHP routines to write such warnings (e.g. standard PHP error_log() function). Normally such a message will be written to the standard PHP's error log. Looks like you do not have it configured at all in your php.ini (empty value) therefore PHP sends it to your standard output instead (so you still can have a chance to see it, as it might be important).

解决办法是指向PHP 的 error_log ini setting 到某个有效位置,以便您可以在需要时读取它(路径取决于您的操作系统和发行版,例如 error_log =/var/log/php_error.log 会很常见).如果你根本不需要这样的日志(有其他日志系统)——使用 /dev/null 或类似的东西.

The solution is to point PHP's error_log ini setting to some valid location so you can read it when needed (path depends on your OS & distro, e.g. error_log = /var/log/php_error.log would be very common). If you do not need such log at all (have other logging system in place) -- use /dev/null or something similar instead.

您也可以尝试 xdebug.log_level = 0 但这应该可以防止 Xdebug 记录任何内容,即使您指定了 xdebug.log.

You can also try xdebug.log_level = 0 but this should prevent Xdebug from logging anything, even if you specify xdebug.log.