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

Executing ddev composer should disable XDebug #4219

Closed
1 task done
mabolek opened this issue Sep 21, 2022 · 4 comments
Closed
1 task done

Executing ddev composer should disable XDebug #4219

mabolek opened this issue Sep 21, 2022 · 4 comments
Milestone

Comments

@mabolek
Copy link

mabolek commented Sep 21, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem?

When executing ddev composer ... while XDebug is enabled, XDebug will debug the composer PHP script. This will lead to the script pausing.

Describe your solution

Composer should be executed with XDebug disabled. This can be achieved by disabling XDebug. One way is to set the environment variable XDEBUG_MODE=off.

Describe alternatives

Disabling XDebug (effectively running ddev xdebug off) before executing the composer command. Then re-enabling XDebug (effectively running ddev xdebug on).

A further extension of the feature could be that XDebug is only disabled for the composer script itself, but not for PHP scripts executed by composer, e.g. still having XDebug enabled when executing the unittests script ddev composer unittests.

Additional context

No response

@rfay
Copy link
Member

rfay commented Sep 21, 2022

I'm pretty sure this is even easier than ddev xdebug off. You can just execute composer with XDEBUG_MODE=off composer ...

https://stackoverflow.com/questions/31083195/disabling-xdebug-when-running-composer#:~:text=As%20of%20Xdebug%203%2C%20it,for%20composer%2C%20by%20aliasing%20composer%20.&text=You%20can%20add%20the%20alias%20to%20your%20%24HOME%2F.

Take a shot at it if you want to!

@mabolek
Copy link
Author

mabolek commented Sep 22, 2022

Hi @rfay!

Thank you for the response. Yes, it could be easier, but how do I do that for the ddev composer command?

ddev XDEBUG_MODE=off composer doesn't work (of course) and XDEBUG_MODE=off ddev composer sets the environment variable outside of the container only.

@rfay
Copy link
Member

rfay commented Sep 22, 2022

No, I'm saying that the golang code that launches composer can have XDEBUG_MODE=off set with it.

https://github.com/drud/ddev/blob/ade420c253121f96e0acbc56d301cfd1eb45ce02/pkg/ddevapp/composer.go#L20-L25

@mabolek
Copy link
Author

mabolek commented Sep 22, 2022

Aha! That's really cool! 😄

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

Successfully merging a pull request may close this issue.

2 participants