-
-
Notifications
You must be signed in to change notification settings - Fork 58
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
[Troubleshooting] PHP 8.1 site with Xdebug causes Bad Gateway error #279
Comments
Hmm... Bad gateway errors are usually resolved by restarting nginx and PHP. Can you restart the Valet services via the menu item and let me know if that solved the issue? (You can also try "Fix My Valet", actually) If neither works, can you let me know the output of |
PHP 8.1.27 (cli) (built: Dec 19 2023 20:35:55) (NTS) |
Works fine if I switch to PHP 8.3 but I run this project on PHP 8.1 in production and I would like my local and production versions match. |
When Xdebug is on
|
So this is only happening with PHP 8.1, correct? And you installed xdebug via the extension manager for that PHP version? |
With gateway errors you can probably find more information by checking the output of Try running |
2024/02/22 17:58:12 [error] 94673#0: *13 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: |
Yes and I have tried installing the extension via the manager. |
Ah, the dreaded premature closed connection w/o much context.
|
Everything is up to date and I've tried |
Can you try the workaround I've linked? |
Tried
Didn't work Tried deleting the sock and installing Valet again didn't work. |
If I disable Xdebug everything works the issue is only when Xdebug is loaded. |
@incon I meant this workaround, updating the Give that a try! When you installed Xdebug, was PHP 8.1 the globally linked PHP version, or not? If the workaround doesn't work I want to see if I can reproduce this issue on my own system. |
I noticed PGGSSENCMODE was already included. I've tried to remove everything and set everything up again Removed brew Removed items not removed by brew uninstall Removed Valet config Removed global composer Reinstall brew
Launched phpmon
|
Switch the site to PHP 8.3 and install extension via ui, configure Xdebug and it works correctly. |
Issue is only when in isolation mode or not set on PHP 8.3 |
I'm trying to reproduce this issue and unfortunately this seems to work correctly here. I've made sure to try both PHP 8.1 linked and isolated (with PHP 8.3 as the primary version and using site isolation). As you can see: What kind of project are you trying to use with Valet? Can you try a simple site? Here's a basic test, that's the one I just did:
<?php
phpinfo(); Does that work? Or are you also getting an error this way? It's always possible that your PHP script itself causes the issue. It's worth checking the nginx log too... |
Only when Xdeug is connected to a debuger is when I get the issue. |
Ah, I see. This may very well be a Xdebug or configuration issue that I'm not familiar with... from what I can tell, the app has correctly installed the extension. How are you debugging with Xdebug? What IDE? What browser? I'll see if I can't repro it on my end. |
Tested a phpinfo.test and it worked with debuging turn on. |
I just tried a blank Laravel project and it worked also. |
I've tried PHPStorm my normal editor and VS Code with the Xdebug plugin. |
Hmm... in that case I don't think I can help you any further, as it's likely an issue with that specific site or project, right? At the very least, I'm going to move this topic to Discussions, should anyone bump into a similar problem they can find this thread there under the troubleshooting section. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Is there an existing issue for this?
Current Behavior
502 Bad Gateway
Expected Behavior
Turning on Xdebug makes every request return a
502 Bad Gateway
errorSteps To Reproduce
Turn on Xdebug and try to debug.
Environment
Do you have a log file (or a screenshot) or any additional information?
No response
The text was updated successfully, but these errors were encountered: