Laravel Valet php-fpm already listening on valet sock
Asked Answered
T

4

14

I've upgraded valet on my macbook (running catalina) and followed the laravel docs including re-running the valet install command and am seeing unexpected 502 Bad Gateway errors. I was checking the logs and found

[27-Aug-2019 20:39:06] ERROR: Another FPM instance seems to already listen on /Users/myuser/.config/valet/valet.sock
[27-Aug-2019 20:39:06] ERROR: Another FPM instance seems to already listen on /Users/myuser/.config/valet/valet.sock
[27-Aug-2019 20:39:06] ERROR: FPM initialization failed
[27-Aug-2019 20:39:06] ERROR: FPM initialization failed
[27-Aug-2019 20:39:17] ERROR: Another FPM instance seems to already listen on /Users/myuser/.config/valet/valet.sock
[27-Aug-2019 20:39:17] ERROR: Another FPM instance seems to already listen on /Users/myuser/.config/valet/valet.sock
[27-Aug-2019 20:39:17] ERROR: FPM initialization failed
[27-Aug-2019 20:39:17] ERROR: FPM initialization failed

It seems there's 3 php-fpm processes running though they all are the same php version (7.3).

Can anyone offer ideas of how to find where the other php-fpm process is being triggered from, and how to fix this issue?

Torpedo answered 28/8, 2019 at 3:43 Comment(0)
T
33

After days of screwing around I found an answer on serverfault that suggested deleting the listening sock. So I ran rm ~/.config/valet/valet.sock and immediately the tailed php log showed

[08-Sep-2019 16:55:48] NOTICE: fpm is running, pid 10316
[08-Sep-2019 16:55:48] NOTICE: ready to handle connections

So I guess that's all there was to it!

Torpedo answered 9/9, 2019 at 0:1 Comment(1)
alternatively, you can run rm ~/.valet/valet.sock, this worked for me.Stalnaker
P
3
brew services list

dnsmasq   started root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
nginx     started root /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
php       started root /Library/LaunchDaemons/homebrew.mxcl.php.plist

brew services restart php

Stopping `php`... (might take a while)
==> Successfully stopped `php` (label: homebrew.mxcl.php)
==> Successfully started `php` (label: homebrew.mxcl.php)

php and php-fpm will work if you reload them

Pronto answered 29/12, 2019 at 16:3 Comment(0)
T
3

Check whether there was an old/extra set of brew services installed:

ls -al /Library/LaunchDaemons/

and compare with:

ls -al ~/Library/LaunchAgents/

Remove duplicated .plist files, e.g.:

 homebrew.mxcl.dnsmasq.plist
 homebrew.mxcl.nginx.plist
 [email protected]

from one of the above folders.

Transonic answered 8/6, 2021 at 1:16 Comment(0)
D
2

Run valet install that should solve your problem. After upgrading Valet version it is required to run this script.

Domain answered 28/8, 2019 at 4:11 Comment(4)
I ran valet install after the composer global update, as specified in the laravel docs. Thanks!Torpedo
Still having the same problem?Domain
Although this looks like a clean solution, it doesn't work. The accepted answer is what worked for me.Polygynous
for me on mac => valet stop - valet install - brew services stop php - valet startSumikosumma

© 2022 - 2024 — McMap. All rights reserved.