'Disable Xdebug 3 "Could not connect" message in CLI
When working with Xdebug 3 in CLI, it constantly reports the message when there are no breakpoints set:
"Xdebug: [Step Debug] Could not connect to debugging client. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-("
Is there a way to disable that message form showing in CLI?
Solution 1:[1]
In my case the problem was that Xdebug tried to run on every request and since I didn't do debugging on every page refresh errors like Xdebug: [Step Debug] Could not connect to debugging client were reported and are understandable.
The most obvious solution with xdebug.log_level = 0 of course worked, but this was too broad and too blind way to fight this for me. So I checked the documentation, and the best way to get rid of that error in my opinion is to tell Xdebug when it should really run and when not, so the right option in my case is:
xdebug.start_with_request = trigger
as the documentation says:
The functionality only gets activated when a specific trigger is present when the request starts.
The name of the trigger is XDEBUG_TRIGGER, and Xdebug checks for its presence in either $_ENV (environment variable), $_GET or $_POST variable, or $_COOKIE (HTTP cookie name).
and I recommend checking at least that part of their docs because there's more info and you can even do more fine tuning if needed.
Solution 2:[2]
Starting from version 3.1, xdebug does not redirect its logs to php logs if you set the path to the log file. In my case, I use the following settings and these messages no longer dazzle the eyes in the console
xdebug.log=/var/www/var/log/xdebug.log
xdebug.log_level=3
PR for this issue: https://github.com/xdebug/xdebug/pull/738
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Picard |
| Solution 2 | ????? ??????? |
