markdown 在macOS Sierra上对Valet进行故障排除

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 在macOS Sierra上对Valet进行故障排除相关的知识,希望对你有一定的参考价值。

# Troubleshooting Valet on Sierra

## Common Problems

### Problem: I just see "It works!"

Apache is running on port 80 and interfering with Valet.

1. Stop Apache: `sudo /usr/sbin/apachectl stop`
2. Restart Valet: `valet restart`

### Problem: Valet randomly dies once in a while.

You are probably still on Valet <= 1.1.19, we recommend pinning to ^1.1.22.

1. Edit `~/.composer/composer.json` to point to `^1.1.22`:

    ```diff
    - "laravel/valet": "^1.1.19",
    + "laravel/valet": "^1.1.22",
    ```

2. Run `composer global update`
3. Restart Valet: `valet restart`


### Problem: 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.

1. Edit `~/.composer/composer.json` to point to `^1.1.22`:

    ```diff
    - "laravel/valet": "^1.1.19",
    + "laravel/valet": "^1.1.22",
    ```

2. Run `composer global update`
3. Ensure you are now running Caddy 0.9.1: `~/.composer/vendor/laravel/valet/bin/caddy -version`
4. Restart Valet: `valet restart`

### Problem: I'm getting a 502 Bad Gateway error.

Usually this means something is fucked with PHP FPM.

1. 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.

2. Check the PHP FPM error log to find out why it's not running:

    `cat /usr/local/opt/php70/var/log/php-fpm.log`

3. Try to resolve any errors you see. Here's a few common ones:

    - [`/var/run/valet/fpm.socket` does not exist](#problem-varrunvaletfpmsocket-does-not-exist)
    - [Failed to open configuration file `/usr/local/etc/php/7.0/php-fpm.conf`](#problem-php-fpmconf-is-missing)

### 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 `/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.

1. Make sure `~/.composer/composer.json` points to `^1.1.22`:

    ```diff
    - "laravel/valet": "^1.1.19",
    + "laravel/valet": "^1.1.22",
    ```

2. Run `composer global update`
3. Run `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 Errors

If you are still running into problems and are a capable adult, 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`

以上是关于markdown 在macOS Sierra上对Valet进行故障排除的主要内容,如果未能解决你的问题,请参考以下文章

markdown 在macOS High Sierra上安装多个Java版本

markdown 在High Sierra上安装Windows 10(macOS 10.13.2)

markdown macOS Sierra上的本地SSL网站

markdown iTerm2 Solarized Dark主题+鱼壳+哦我的鱼/// macOS High Sierra

markdown macOS High Sierraでpycallを使ってたら“__ NSPlaceholderDictionary initialize”エラー

macOS High Sierra Xcode中的代码签名错误 - 不允许使用资源分支,Finder信息或类似碎片