Álvaro González
Álvaro González

Reputation: 146450

Disable HTML stack traces by Xdebug

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:

Unreadable stack trace

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?

Upvotes: 21

Views: 24363

Answers (3)

hakre
hakre

Reputation: 197732

Check for xdebug_disable()Docs:

Disables stack traces

Disable showing stack traces on error conditions.

See as well xdebug.default_enableDocs:

boolean xdebug.default_enable = true

If this setting is 1, then stacktraces will be shown by default on an error event. You can disable showing stacktraces from your code with xdebug_disable(). As this is one of the basic functions of Xdebug, it is advisable to leave this setting set to 1.

Upvotes: 14

Sumoanand
Sumoanand

Reputation: 8929

Add following code in the initialization Script:

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

Upvotes: 6

Derick
Derick

Reputation: 36774

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

Upvotes: 14

Related Questions