I encountered constant 502 Bad Gateway error after a fresh installation of Homestead v8.0.0. After searching, I found that it was related to php 7.3 mod xdebug. I tried
```
sudo phpdismod xdebug
sudo service php7.3-fpm reload
and it successfully resolved the problem (as what is in the two links in the Reference part).
But I'm helping out some other students to start on Homestead as well, and it may not be good if I have to disable xdebug after installation every time, let alone xdebug may be used in the future.
Anyway, is there any better solution for it (Maybe xdebug team is trying to solve the compatibility issue with php 7.3? But before that, maybe it would be better to disable mod xdebug by default in Homestead v8.x and add some explanation about this in the documentation, such that at least people would not see 502 after initial installation)?
## Versions
- Vagrant: Vagrant 2.2.3
- Provider: Virtualbox 6.0.2r128162
- Homestead: homestead v8.0.0
## Host operating system
macOS Mojave Version 10.14.2
## Homestead.yaml
```yaml
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/code
to: /home/vagrant/code
sites:
- map: homestead.test
to: /home/vagrant/code/homestead/public
databases:
- homestead
backup: true
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# zray:
# If you've already freely registered Z-Ray, you can place the token here.
# - email: [email protected]
# token: foo
# Don't forget to ensure that you have 'zray: "true"' for your site.
Test site loaded.
502 Bad Gateway displayed. Tried refreshing many times, and for few times the page could be displayed, but for most times it was 502 error.
I had the same problem. Random 502 errors between page loads.
from inside the VM run sudo phpdismod xdebug. if the issue continues then it's likely still issues upstream with PHP 7.3 You can override and go back to 7.2 by adding php: '7.2' to your Homestead.yaml
Reverting to PHP v7.2 in Homestead.yaml fix it.
sites:
- map: example.test
to: /home/vagrant/code/public
php: "7.2"
Is it possible to enable xdebug for some sites and disable it for the others?
I disable xdebug by running sudo phpdismod xdebug and everything went fine, but I need it now for a new project.
As of xdebug v2.7.0RC2 (and therefore v2.7.0 onwards) it looks like this is fixed.
Is it possible to enable xdebug for some sites and disable it for the others?
Only per PHP version
Fixed in Homestead 8.4.0
Hi i have similar problem on Homestead 10.8 on Windows 10. I configured it with the following yaml:
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: D:\Gustavo\gdrive\www\learn
to: /home/vagrant/learn
sites:
- map: homestead.test
to: /home/vagrant/learn/public
databases:
- homestead
features:
- mariadb: false
- ohmyzsh: false
- webdriver: false
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
Changed to Apache and worked fine.
sites:
- map: homestead.test
to: /home/vagrant/learn/public
type: "apache"
Also, ngnix was giving long response times with ping and also some packages missing.
Changed to Apache and worked fine.
sites: - map: homestead.test to: /home/vagrant/learn/public type: "apache"Also, ngnix was giving long response times with
pingand also some packages missing.
Thank you very much. And did you know how to fix this issue without changing of type of the server?
Most helpful comment
Reverting to PHP v7.2 in
Homestead.yamlfix it.