VladacusB
VladacusB

Reputation: 844

PHP 8 Xdebug 3 Stack trace display output

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

Upvotes: 0

Views: 1383

Answers (2)

jlcfly
jlcfly

Reputation: 19

For anyone else who is having this issue, and xdebug.mode includes develop...

Check log_errors. If it's On and there's no error_log value set, either set error_log or turn log_errors off. This also resolves the problem of getting only an error and not the rest of the page when an error occurs, at least on PHP 8.2.

Upvotes: 0

LazyOne
LazyOne

Reputation: 165511

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...

Upvotes: 2

Related Questions