Laravel Valet php-fpm 已经在监听 valet sock

Laravel Valet php-fpm already listening on valet sock

我已经在我的 macbook (运行 catalina) 上升级了 valet,并遵循了 laravel 文档,包括重新 运行 valet install 命令,我看到了意想不到的 502 Bad Gateway错误。我正在检查日志并发现

[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

似乎有 3 个 php-fpm 进程 运行 尽管它们都是相同的 php 版本 (7.3)。

任何人都可以提供有关如何查找其他 php-fpm 进程的触发位置以及如何解决此问题的想法吗?

运行 valet install 应该可以解决您的问题。升级 Valet 版本后需要 运行 这个脚本。

经过几天的折腾,我在 serverfault 上找到了一个建议删除监听袜子的答案。所以我 运行 rm ~/.config/valet/valet.sock 并且尾部 php 日志立即显示

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

所以我想这就是它的全部内容!

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 和 php-fpm 将在您重新加载它们后工作

检查是否安装了 old/extra 组 brew 服务:

ls -al /Library/LaunchDaemons/

并比较:

ls -al ~/Library/LaunchAgents/

删除重复的 .plist 文件,例如:

 homebrew.mxcl.dnsmasq.plist
 homebrew.mxcl.nginx.plist
 homebrew.mxcl.php@7.4.plist

来自上述文件夹之一。