Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Every php executable produces multiple Xdebug warnings #902

Open
artm opened this issue Dec 26, 2023 · 3 comments
Open

Every php executable produces multiple Xdebug warnings #902

artm opened this issue Dec 26, 2023 · 3 comments

Comments

@artm
Copy link

artm commented Dec 26, 2023

When using PHP CLIs inside the dev container they produce multiple warnings like:

Xdebug: [Step Debug] Could not connect to debugging client. Tried: localhost:9000 (through xdebug.client_host/xdebug.client_port).

The CLIs work as intended, but the warnings make the CLI experience uncomfortable, especially when repeated 20 times after the normal output of a utility.

As I understand the image enables Xdebug functionality so user's own PHP code can be debugged with F5. I know I won't be doing that, what is the best way to disable it in a dev container?

I tried to add

  "remoteEnv": {
    "XDEBUG_CONFIG": "mode=off"
  },

to devcontainer.json but it has no effect.

@artm
Copy link
Author

artm commented Dec 26, 2023

My current workaround is:

  "onCreateCommand": "sudo rm /usr/local/etc/php/conf.d/xdebug.ini",

@eljog
Copy link
Member

eljog commented Jan 4, 2024

I am not familiar with the PHP dev stack. Have you explored if the behavior can be controlled through the extension settings for PHP Debug extension that comes with the image? extension info here

@artm
Copy link
Author

artm commented Jan 4, 2024

I'm not familiar either, I'm running it in a dev container as I'm learning PHP :-)

As far as I understand the problem is that when xdebug is enabled (which it is in the image with the /usr/local/etc/php/conf.d/xdebug.ini config file) anything executed with php tries to connect to the debugger UI. When I'm using PHP-based CLIs in command line there is no debugger listening on port 9000, and it isn't my intention to debug these tools. I was hoping I would be able to disable the xdebug with environment variable XDEBUG_CONFIG as described here but it doesn't seem to help. Perhaps I'm doing something wrong.

I'll have a look at the VSCode extension documentation for some hints, but with only a small hope: the warning is printed exactly because I'm not using the extension when calling PHP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants