php 通过 Xdebug 禁用 HTML 堆栈跟踪

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6911897/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 01:35:27  来源:igfitidea点击:

Disable HTML stack traces by Xdebug

phpxdebugmod-php

提问by álvaro González

The administrator has installed Xdebug 2.1.1 in our shared PHP 5.3.0 server in order to use its debugger. Now, I can hardly read the stack traces of uncatched exceptions because they are formatted by Xdebug with annoying colours that interact badly with the site's CSS:

管理员已在我们共享的 PHP 5.3.0 服务器中安装了 Xdebug 2.1.1,以便使用其调试器。现在,我几乎无法读取未捕获异常的堆栈跟踪,因为它们是由 Xdebug 格式化的,带有与站点 CSS 交互不良的烦人颜色:

Unreadable stack trace

不可读的堆栈跟踪

Since PHP runs as Apache module, I've tried to disable this feature in an .htaccessfile but I can't make it go:

由于 PHP 作为 Apache 模块运行,因此我尝试在.htaccess文件中禁用此功能,但无法执行:

php_flag xdebug.default_enable Off
php_flag xdebug.overload_var_dump Off
php_flag xdebug.show_exception_trace Off
php_value xdebug.trace_format 1

phpinfo()shows my changes in the Local Valuecolumn but I can still see those horrible orange tables. What's the directive I need to change?

phpinfo()本地值列中显示了我的更改,但我仍然可以看到那些可怕的橙色表格。我需要更改的指令是什么?

采纳答案by hakre

Check for xdebug_disable()Docs:

检查xdebug_disable()文档

Disables stack traces

Disable showing stack traces on error conditions.

禁用堆栈跟踪

禁用在错误情况下显示堆栈跟踪。

See as well xdebug.default_enableDocs.

另请参阅xdebug.default_enableDocs

回答by Derick

You need to make sure you have html_errors=0in PHP as well. Also, orange isn't horrible ;-)

你需要确保你也有html_errors=0PHP。此外,橙色并不可怕;-)

回答by Sumoanand

Add following code in the initialization Script:

在初始化脚本中添加以下代码:

 if (function_exists('xdebug_disable')) {
           xdebug_disable();
         }