3

I was able to get Laravel Valet version 1.0.12 to work, but when I did the update to 1.1.12 this morning, I am now getting a 502 - Bad Gateway error. I am not running any other server instance, that I am aware of.

Also, I have tried running "valet install" again, and rebooting, but I still get the same error.

I am not sure if I missed something, or what would cause this. Any ideas? Let me know if you need me to provide details on anything that might help.

Thanks in advance!

patricus
  • 59,488
  • 15
  • 143
  • 145
jldavis76
  • 812
  • 2
  • 15
  • 42

6 Answers6

14

I had the same issue, and found help on the Laravel Slack Chat!

Apparently the issue comes from the fact that php-fpm is not running (and wasn't installed).

What I did to solve the issue is reinstalling PHP with fpm.

brew uninstall php70

and then:

brew install php70 --with-fpm

don't forget to restart valet:

valet restart

Hope this works for you too!

David Lartey
  • 531
  • 8
  • 15
Gabor
  • 394
  • 5
  • 12
  • Following these instructions, and restarting my computer afterwards, finally got it to work. If anyone looking for help with this issue is still having problems, I'd advise reading the chat transcript from @Chris as well. He had a lot of good input. – jldavis76 May 10 '16 at 14:37
  • I had to run `brew uninstall php70` and then `brew install php70 --with-fpm --build-from-source` – james2doyle Jun 08 '16 at 21:12
  • 1
    This is not the solution. `$ brew install php70` by default installs fpm. If you checkout `$ brew info php70` you see there is only a --without-fpm flag option. The only reason that this probably works is because brew starts fpm as root. When valet did not work for me and when I did `$ brew services list`, it was running as the current user. I stopped it: `$ brew services stop dnsmasq` fallowed by `$ sudo brew services start dnsmasq` (notice the `sudo`!) it worked again for me. (Don't forget to run `$ brew update` before installing anything with brew). – Ilyes512 Jul 27 '16 at 20:17
  • For me the issue was that I had to add ```/usr/local/sbin``` before ```/usr/sbin``` in my path. On OS X you can do this by editing ```/etc/paths```. After you edit restart your terminal session and do a ```valet restart``` – greatwitenorth Sep 19 '16 at 20:55
2

I haven't used Valet, but I saw Taylor mention that he switched Valet to use the Caddy web server. Did you run composer global update to update Valet and valet install to create the new Caddy daemon?

Chris
  • 3,729
  • 22
  • 30
  • Yes, I followed the directions in the Laravel documentation exactly. – jldavis76 May 09 '16 at 17:40
  • Okay. Are you running nginx or Apache? You need to check your web server's error log. – Chris May 09 '16 at 17:41
  • I'm not running Apache or Nginx, and from what I can tell, nothing is being shown in the web server's error log. I'm not trying to make this difficult, I'm just unsure of how to proceed. – jldavis76 May 09 '16 at 17:49
  • Sorry yeah, I'm talking nonsense. As it's using Caddy now, it should log to the Caddy error log. I'm not sure if Valet is configured to log errors? – Chris May 09 '16 at 17:50
  • Any idea of where I would find the Caddy error log on a Mac? – jldavis76 May 09 '16 at 17:51
  • @jldavis76 Okay, it looks like Caddy with Valet is not configured to log errors. Open your `Caddyfile` and after the `rewrite` block, add: `errors error.log`. Then refresh and check that log. – Chris May 09 '16 at 17:54
  • Quick question that will probably seem a little silly...does the update to valet automatically install whatever version of Caddy it needs to work? – jldavis76 May 09 '16 at 17:58
  • So, another probably simple question, where would I find the Caddyfile for this installation? – jldavis76 May 09 '16 at 18:01
  • @jldavis76 Actually, what is the output of `$ valet logs`? – Chris May 09 '16 at 18:05
  • It shows: Stack trace: #0 {main} That's it. Handy to know that's how to see the logs though. – jldavis76 May 09 '16 at 18:12
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/111461/discussion-between-chris-and-jldavis76). – Chris May 09 '16 at 18:14
  • This helped me. Thanks. – shin Aug 20 '16 at 12:46
2

There is a newer version now, but i had to do the following:

So the process I had to fix the issues seems to be:

  • remove valet completely (some reason valet uninstall does nothing)
  • stop apache (apachectl stop)
  • composer global require laravel/valet
  • valet install
  • valet restart

Besides my bespoke driver the above seems to have fixed the issue...

Simon Davies
  • 3,668
  • 9
  • 41
  • 69
1

I just met the same problem. It seems that dnsmasq make this problem in my computer. so just remove it by

  • valet uninstall
  • brew uninstall dnsmasq
  • valet install

(valet install will install php70 and dnsmasq)

It works!!

Liu.handy
  • 59
  • 3
0

Did you execute "valet park" in your projects folder?

Sky Liu
  • 21
  • 1
  • Just as a note, this is not really an answer and more suitable as a [comment](http://stackoverflow.com/help/privileges/comment) (you can post comments once you reach 50 reptuation) – Steve Heim May 10 '16 at 01:49
  • sorry about this. this is my first post in my life time. – Sky Liu May 10 '16 at 01:53
  • No worries, and you can't post comments yet anyhow. Just so you know once you get there : ) – Steve Heim May 10 '16 at 02:21
0

i had the same problem on OS X and it was due to an old version of nginx.

If you have nginx installed on your Mac, try to stop or remove it.

Hope that helps ^^

ssice
  • 3,564
  • 1
  • 26
  • 44