laravel brew 链接 php71:无法符号链接 sbin/php-fpm

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46778133/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 16:48:53  来源:igfitidea点击:

brew link php71: Could not symlink sbin/php-fpm

phplaravelhomebrewlaravel-valet

提问by AlxVallejo

I'm trying to install Laravel Valet, which requires php 7.1, but when i run brew install php71, I get the following error:

我正在尝试安装需要 php 7.1 的 Laravel Valet,但是当我运行 brew install php71 时,出现以下错误:

==> Pouring php71-7.1.10_21.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink sbin/php-fpm
/usr/local/sbin is not writable.

I get the same error when i run brew link php71. If i run php -v, I actually see that I'm currently running PHP 7.1.7.

我运行时遇到同样的错误brew link php71。如果我运行php -v,我实际上看到我当前正在运行 PHP 7.1.7。

But when I run valet install, I get:

但是当我运行 valet install 时,我得到:

  [DomainException]
  Unable to determine linked PHP.

I don't even have an sbin directory in /usr/local.

我什至在 /usr/local 中都没有 sbin 目录。

Any suggestions?

有什么建议?

回答by QIfan Guo

I solved this problem by first creating the directory sbin:

我通过首先创建目录解决了这个问题sbin

sudo mkdir /usr/local/sbin

then if you are like me using macOS highSierra 10+ you need to run:

那么如果你像我一样使用 macOS highSierra 10+ 你需要运行:

sudo chown -R $(whoami) $(brew --prefix)/sbin

after this

在这之后

brew link php

回答by Sam

Installing Laravel Valet, I had a similar issue with sbin not being writable. I had to make the directory, then utilized the solution included at this page. This finally allowed me the proper permissions to run a brew link command with a previously installed version of php 7.1.

安装 Laravel Valet,我遇到了类似的 sbin 不可写问题。我必须创建目录,然后使用此页面中包含的解决方案。这最终使我获得了使用先前安装的 php 7.1 版本运行 brew link 命令的适当权限。