在 macOS Sierra 上对 Laravel Valet 进行故障排除
发布于 作者: Eric L. Barnes
macOS Sierra 几天前刚刚发布,每个人都开始升级。一些 Laravel Valet 用户报告了一些问题,而 Adam Wathan 已经整理了一个 列表 ,其中包含常见的错误和故障排除技巧,以帮助解决他所遇到的问题。
经他允许,这里列出了一些需要查找的内容
我只看到“它有效!”
Apache 在端口 80 上运行,与 Valet 发生冲突。
- 停止 Apache:
sudo /usr/sbin/apachectl stop
- 重新启动 Valet:
valet restart
Valet 随机死亡
您可能仍在使用 Valet <= 1.1.19,建议将其锁定为 ^1.1.22。
首先,编辑 ~/.composer/composer.json
以指向 ^1.1.22
,如下所示
```diff- "laravel/valet": "^1.1.19",+ "laravel/valet": "^1.1.22",
Next, run `composer global update` and then restart Valet with it’s `valet restart` command. Every time I refresh I see a totally random file!------------------------------------------------- You are running Caddy 0.9.2, which has a known bug related to fastcgi connections. Edit your `~/.composer/composer.json` to point to `^1.1.22` like this:
- "laravel/valet": "^1.1.19",+ "laravel/valet": "^1.1.22",
Next, run `composer global update`, ensure you are now running Caddy 0.9.1 by running `~/.composer/vendor/laravel/valet/bin/caddy -version` and finally restart Valet `valet restart` I’m getting a 502 Bad Gateway error.------------------------------------ Usually, this means something is messed up with PHP FPM. The first step is to confirm that FPM is *not* running:
ps aux | grep fpm
You should see at least two processes there if PHP FPM is running (one is grep, ignore that one.) Chances are PHP FPM *is not* running. Next, check the PHP FPM error log to find out why it’s not running:
cat /usr/local/opt/php70/var/log/php-fpm.log
Try to resolve any errors you see. Here’s a few common ones: - `/var/run/valet/fpm.socket` does not exist- Failed to open configuration file `/usr/local/etc/php/7.0/php-fpm.conf` Problem: /var/run/valet/fpm.socket does not exist!-------------------------------------------------- If you see an error similar to: > Unable to bind listening socket for address ‘/var/run/valet/fpm.socket’: No such file or directory in the file `/usr/local/opt/php70/var/log/php-fpm.log`, you were probably running `dev-master` and have now switched back to tagged releases. Valet 1.1.22 attempts to automate fixing this issue by explicitly configuring where PHP FPM should listen. First make sure `~/.composer/composer.json` points to `^1.1.22`:
- "laravel/valet": "^1.1.19",
- "laravel/valet": "^1.1.22",
Then run `composer global update` and finally `valet install`. Problem: php-fpm.conf is missing!--------------------------------- Something went wrong when installing PHP through Homebrew. This seems to happen on fresh non-upgrade installations of macOS Sierra. 1. Uninstall PHP 7: `brew uninstall php70`2. Reinstall PHP 7 from source: `brew install php70 --build-from-source`3. Re-run `valet install` Where to Look for Valet Errors?------------------------------- If you are still running into problems, here’s a list of log files to check: **Caddy start log:**
/tmp/com.laravel.valetServer.err
**PHP FPM error log:**
/usr/local/opt/php70/var/log/php-fpm.log
**Caddy error log:**
~/.valet/Log/error.log
Hopefully with this guide you will be able to pinpoint any errors you have and can fix them through either Brew or Composer.