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

php7.3-fpm resulting in bad gateway #1031

Closed
martijn94 opened this issue Jan 15, 2019 · 25 comments

Comments

@martijn94
Copy link
Contributor

commented Jan 15, 2019

In the newest version of homestead (8.0.0) the default PHP version is 7.3. However there seems to be a problem on a freshly provisioned install. NGINX returns a 502 bad gateway when provisioned for php-7.3.

When switching fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; to fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; the site loads fine again.

Error in NGINX log:

2019/01/15 09:15:59 [error] 539#539: *15 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.10.1, server: com.nbs.test, request: "GET /wp-admin/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "com.nbs.test"

Error in PHP-FPM log:

[15-Jan-2019 09:32:14] WARNING: [pool www] child 904 exited on signal 11 (SIGSEGV - core dumped) after 1006.631644 seconds from start
[15-Jan-2019 09:32:14] NOTICE: [pool www] child 988 started

Error in /var/log/syslog

Jan 15 09:32:14 vagrant kernel: [ 1538.380198] php-fpm7.3[904]: segfault at 7ffdc3952ff8 ip 000055e499dad9e0 sp 00007ffdc3953000 error 6 in php-fpm7.3[55e499b2b000+3e6000]

My debugging skills didn't go any further unfortunately.

Versions

  • Vagrant: 2.2.2
  • Provider: Virtualbox
  • Homestead: 8.0.0
  • Homestead box: 7.0.0 (same issue on 6.4.0)

Host operating system

MacOS 10.14.2

Homestead.yaml

---
ip: "192.168.10.10"
name: "Vagrant V2"
hostname: martijn.local
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Sites
      to: /home/vagrant/sites
      type: nfs

sites:
    - map: sandbox.test
      to: /home/vagrant/sites/sandbox
    - map: com.nbs.test
      to: /home/vagrant/sites/nbs

Vagrant destroy & up output

https://gist.github.com/martijn94/8bbd717d0c9b29f49068641589eb1d37

Expected behavior

Site loads for a added site

Actual behavior

Nginx returns 502 bad gateway

Steps to reproduce

Provision fresh box with the latest versions of homestead.

@ghost

This comment has been minimized.

Copy link

commented Jan 15, 2019

I get this for Windows 10.

@zecipriano

This comment has been minimized.

Copy link

commented Jan 15, 2019

Having the same issue. Setting the php version to 7.2 in Homestead.yaml works as temporary fix.

@svpernova09

This comment has been minimized.

Copy link
Member

commented Jan 15, 2019

@martijn94

This comment has been minimized.

Copy link
Contributor Author

commented Jan 15, 2019

Were you using 7.3 on the previous box? My guess is it's a 7.3 bug: https://bugs.php.net/search.php?limit=30&order_by=id&direction=DESC&cmd=display&status=Open&bug_type=All&phpver=7.3

Seems like it, can confirm not working on 7.20.0. Also this issue seems very related: https://bugs.php.net/bug.php?id=77430

@svpernova09 Maybe it's an idea to revert the default version back to 7.2 until this is fixed?

@svpernova09

This comment has been minimized.

Copy link
Member

commented Jan 15, 2019

@svpernova09 Maybe it's an idea to revert the default version back to 7.2 until this is fixed?

You can specify PHP 7.2 in your sites config.

Homestead major versions denote either a change in the underlying Ubuntu base, or us specifying a different default PHP version. If we went back to 7.2 as the default (Which goes against our principle of supporting what php.net supports in terms of versions) then we would have to bump another major version, then again when we went back to 7.3 as the default. Since there is nothing Homestead can do to fix the 7.3 bugs it doesn't make sense for us to ping pong defaults, especially when it's a 1 line change such as specifying a PHP version in Homestead.yaml

@martijn94

This comment has been minimized.

Copy link
Contributor Author

commented Jan 15, 2019

@svpernova09 That makes sense, thanks for the explanation.

@stuartcusackie

This comment has been minimized.

Copy link

commented Jan 18, 2019

I understand the reasons why you have to release updates as you do, but I spent a frustrating hour trying to fix this with no clues. PHP 7.2 solved it.

If there's any way to issue some kind of warning that the php version isn't compatible when running vagrant up then that would save a lot of pain.

Mine was a fresh box on windows 10.

@svpernova09

This comment has been minimized.

Copy link
Member

commented Jan 18, 2019

Mine was a fresh box on windows 10 so I was not using PHP 7.2 on the box beforehand

I (sometimes painstakingly) stick to semantic versioning with Homestead. That means if you have a box working on version 7.x and you install 8.x you should expect major things to be different. (In this case it was the default PHP version). There's not much more I can do to warn people. I publish a commit summary on every release. At some point the documentation has to be enough, even for longtime users that may be comfortable with the platform.

If there's any way to implement some kind of warning that the php version isn't compatible when running vagrant up then that would save a lot of pain.

Vagrant has no knowledge of what's inside the virtual machine.

@stuartcusackie

This comment has been minimized.

Copy link

commented Jan 18, 2019

@svpernova09 Cheers. I may start doing that myself. Appreciate all your effort.

@svpernova09

This comment has been minimized.

Copy link
Member

commented Jan 18, 2019

@svpernova09 Cheers. I may start doing that myself. Appreciate all your effort.

I probably should update the motd to announce the new versions. That way you'd at least see it in your face when you vagrant ssh

@hezhizheng

This comment has been minimized.

Copy link

commented Jan 20, 2019

I tried to take the time to solve this problem, it seems that I can only use php7.2 first.

@hans-vds

This comment has been minimized.

Copy link

commented Jan 21, 2019

I just set up a Homestead environment in Windows 10 (Virtual Box 6, Vagrant 2.2.3, php 7.3), and was annoyed with "Bad Gateway 502" errors (nginx) in Firefox, and regularly in Chrome and Opera. I looked for many hours trying to resolve it, altering configurations of nginx and php.ini, with no result whatsoever. The solution was to add php: "7.2" to my homestead.yaml file, so:

sites:
- map: homestead.test
to: /home/vagrant/code/laravel/public
php: "7.2"

This post put me on the right track, so many thanks to Martijn94!

@adriandmitroca

This comment has been minimized.

Copy link

commented Jan 21, 2019

@hans-vds: FYI, 502 error has nothing in common with the browser of your choice whatsoever.

Speaking of, is it possible to define default PHP version for whole Homestead box rather than specifying it for each site?

@hans-vds

This comment has been minimized.

Copy link

commented Jan 21, 2019

That seems not to be the case, as discussed in this post:

#756

Might have changed in the meantime though. I don't mind though adding that one line for every site ;)

@svpernova09

This comment has been minimized.

Copy link
Member

commented Jan 21, 2019

@adriandmitroca By not specifying a PHP you are going to default to 7.3.

@browner12

This comment has been minimized.

Copy link
Contributor

commented Jan 21, 2019

For me this was related to Xdebug, which doesn't seem to yet be compatible with PHP 7.3.

To continue using 7.3, you can turn Xdebug off with

sudo phpdismod xdebug

sudo service php7.3-fpm reload
@chescos

This comment has been minimized.

Copy link

commented Jan 21, 2019

Had the same issue, using PHP 7.2 fixed it.

@ghost

This comment has been minimized.

Copy link

commented Jan 25, 2019

Had a similar issue.

NGINX returns a 502 bad gateway for first page load.. when refreshing the same page.. it gets loaded fine with no error.

Disabling Xdebug as @browner12 said.. solved my issue.

@marcelogarbin

This comment has been minimized.

Copy link

commented Jan 27, 2019

Hi, Has this been adjusted?

@browner12

This comment has been minimized.

Copy link
Contributor

commented Jan 27, 2019

There's nothing to be adjusted. We're waiting for an upstream fix from Xdebug. For now either disable xdebug or set your sites to use 7.2

@chescos

This comment has been minimized.

Copy link

commented Jan 27, 2019

@browner12 wouldn't it make sense to change the defaults? I made a clean Laravel + Homestead install and ran into this issue, took me 2 hours of pointless search through PHP/Nginx issues until I found this issue here and fixed it in 30 seconds. Talked to a friend a few days later and he told me he recently gave up on homestead since it throws 502 all the time.

Just seems weird when something is broken by default, not sure how many people even bother to try and find the fix.

@marcelogarbin

This comment has been minimized.

Copy link

commented Jan 27, 2019

@browner12 Okay, so I also did a clean installation on 01/25, but only today I was using the homestead and I was faced with this error, as in the old installation, PHP 7.2 was checking which version was PHP of this new installation, which is or 7.3. It did not take me that long to verify that the problem was with PHP 7.3 (I think), so I'm using 7.2 as usual.
I'm going to use 7.2 until I adjust this Xdebug issue so I just asked because I thought it should be something with the Homestead.

Grateful for the attention

@GrahamCampbell

This comment has been minimized.

Copy link
Member

commented Feb 4, 2019

Update: PHP 7.3.2RC1 + xdebug 2.7.0RC1 should work properly with laravel.

@Jakhongir91

This comment has been minimized.

Copy link

commented Mar 29, 2019

Having the same issue. Setting the php version to 7.2 in Homestead.yaml works as temporary fix.

Thanx that is worked for me!

@ryancwalsh

This comment has been minimized.

Copy link

commented Apr 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.