Disable HTML stack traces by Xdebug
Solution 1
Check for xdebug_disable()
Docs:
Disables stack traces
Disable showing stack traces on error conditions.
See as well xdebug.default_enable
Docs.
Solution 2
You need to make sure you have html_errors=0
in PHP as well.
Also, orange isn't horrible ;-)
Solution 3
Add following code in the initialization Script:
if (function_exists('xdebug_disable')) {
xdebug_disable();
}
Álvaro González
Hi! I'm not asking you to enable error reporting, share the verbatim error message, inspect variables... to annoy you and show off how much fancy stuff I know. That's the straightforward problem solving method. Why guess and try random stuff for days when the language engine can tell you the exact issue? If you don't know what I mean or how to apply it, please don't pretend you didn't read my comments. Instead, ask for clarifications—I'll be glad to guide you. Further listening Mi sitio de programación en español: Borrame.com The humour site I haven't updated since 2004: Demogracia Mi hosting actual: Guebs.com
Updated on July 09, 2022Comments
-
Álvaro González almost 2 years
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:
Since PHP runs as Apache module, I've tried to disable this feature in an
.htaccess
file but I can't make it go: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 Value column but I can still see those horrible orange tables. What's the directive I need to change? -
Álvaro González almost 13 yearsI'm not sure I get it. I already use HTML errors, together with
error_prepend_string
anderror_append_string
so I can display line feeds. If I disable it, Xdebug does not draw HTML but that makes the error unreadable as well because everything's in a single line. I don't want to search for error messages in the View Source window... -
Álvaro González almost 13 years
xdebug.default_enable
has no apparent effect, but callingxdebug_disable()
on top of my code works fine. I'll see how to pack it in my web site settings. -
hakre almost 13 yearsTry to put
xdebug.default_enable
into the system's php.ini, maybe that works. Additionally probably using0
instead ofoff
in the .htaccess configuration might also help, but that's just an assumption, I have not tested it. -
Álvaro González almost 13 yearsAlright... I've done further testing and the directive is
xdebug.default_enable
but it seems there's a bug somewhere: in the shared development server it's ignored, in my local installation its fully honoured. -
hakre almost 13 years@Álvaro G. Vicario: Are you still using the .htaccess configuration method or are you using php.ini? Just asking for clarification.
-
Álvaro González almost 13 yearsJust tried
.htaccess
(being a shared resouce, I don't want to disturb others). It's worth nothing that phpinfo() reports the directive as changed in all cases. I wrote a quick workaround withauto_prepend_file
that works for me. -
hakre almost 13 yearsI was close to suggest auto prepend file as well, however I really wonder why the .htaccess rules do not properly work. Maybe it's a mod_php issue or something.
-
Dr Casper Black about 11 yearsxdebug.default_enable=off in php.ini worked with php5.4 on debian
-
Álvaro González over 9 yearsPlease note that remote_autostart and remote_enable control the debugger. They have nothing to do with stack traces.
-
Pere over 8 yearsVery useful if you are outputting json from PHP for use with Javascript, angular, and that all.
-
rockerston about 8 yearsLike Alvaro said, Option #2 here has nothing to do with displaying the HTML stack trace.
-
Sumoanand about 8 yearsUpdated as per suggestion.
-
Jeroen Vermeulen - MageHost about 7 yearsIf @derick answers you had better listen. He wrote XDebug.