Home > Net >  PHP 8 Xdebug 3 Stack trace display output
PHP 8 Xdebug 3 Stack trace display output

Time:10-15

How can I get Xdebug v3.1.1 to display output "beautified" with PHP 8.1? Is it necessary to turn on some specific Xdebug configuration option in php.ini?

This is how I need the output on screen to look like:

Stack trace output

And this is how it currently looks like:

Current php error output to screen

This is my current Xdebug configuration in php.ini for PHP 8.1:

[XDebug]
xdebug.client_host=127.0.0.1
xdebug.client_port=9000
xdebug.mode=debug
xdebug.profiler_append = 0
xdebug.start_with_request=trigger
xdebug.remote_handler = dbgp
xdebug.start_with_request=yes
xdebug.log_level = 0
xdebug.force_display_errors=1
xdebug.force_error_reporting=1
xdebug.show_error_trace=1
xdebug.show_exception_trace=1
xdebug.cli_color = 1
xdebug.trace_format=1 
xdebug.show_local_vars=1

CodePudding user response:

You need to also list develop in the debug mode value:

xdebug.mode=debug,develop

P.S. Rather unrelated... but better stick to the new Xdebug port (9003) and not old one 9000 -- it was changed for a reason (as it was often conflicting with php-fpm that also uses the same TCP 9000 port by default).

Sure, if it works then do not change .. but it's better to use safer option (may save a lot of troubleshooting time on a new machine/different setup in a future).

ALSO: xdebug.remote_handler = dbgp -- this is Xdebug v2, does nothing in Xdebug 3. And dbgp is the ONLY possible value anyway...

  • Related