问题描述
我正在尝试安装Laravel的Valet,该依赖项需要PHP7.当我尝试用Homebrew安装PHP 7时,出现以下错误:
I'm trying to setup Laravel's Valet which, as a dependency, requires PHP 7. When I try to install PHP 7 with Homebrew I get the following error:
Configuring SAPI modules
checking for Apache 2.0 handler-module support via DSO through APXS...
Sorry, I cannot run apxs. Possible reasons follow:
1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)
The output of /usr/sbin/apxs follows:
apxs:Error: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/apr-1-config not found!.
configure: error: Aborting
READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/brew):
https://github.com/Homebrew/homebrew-php/issues
These open issues may also help:
php70-dbase https://github.com/Homebrew/homebrew-php/issues/3508
php70-intl not found https://github.com/Homebrew/homebrew-php/issues/3591
php70-opcache install issue https://github.com/Homebrew/homebrew-php/issues/3586
Problem installing php70-mcrypt, php70-opcache, php70-xdebug on El Capitan https://github.com/Homebrew/homebrew-php/issues/3587
Add php70-zmq formula https://github.com/Homebrew/homebrew-php/pull/3474
Problem installing homebrew/php/php70-imagick https://github.com/Homebrew/homebrew-php/issues/3571
Install PHP70: Incompatible library version https://github.com/Homebrew/homebrew-php/issues/3444
brew install php70-redis https://github.com/Homebrew/homebrew-php/issues/2762
Allow --enable-redis-igbinary for php70-redis https://github.com/Homebrew/homebrew-php/pull/3473
Add head formula for php70-uploadprogress https://github.com/Homebrew/homebrew-php/pull/3178
这是在全新安装的macOS Sierra(实际发行版,不是 Beta)上,以及全新安装的Homebrew(已更新).我已经安装,运行并同意Xcode许可协议.
This is on a fresh install of macOS Sierra (actual release, not a beta) with a fresh install of Homebrew (updated). I have installed, ran and agreed to the Xcode licensing agreement.
我不知道这些错误是什么意思或如何解决.谁能提供任何帮助?
I have no idea what these errors mean or how to fix them. Can anyone offer any help?
谢谢.
推荐答案
对,我已经知道了.我在下面发布了成功安装require组件的步骤,以防其他人偶然发现此问题:
Right I've figured it out. I'm posting the steps to successfully install the require components below in case anybody else stumbles upon this issue:
1).确保自制软件是最新的:
1). make sure Homebrew is up to date:
brew update
2).通过确保已安装Xcode并在终端中键入以下内容来修复PHP 7错误:
2). Fix the PHP 7 error by making sure Xcode is installed and then typing the following into the Terminal:
brew install apr apr-util
sudo mkdir -p /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
sudo ln -s /usr/local/opt/apr/bin/apr-1-config /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
sudo ln -s /usr/local/opt/apr-util/bin/apu-1-config /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
3).运行以下命令(否则,PHP安装将抱怨缺少libz):
3). Run the following command (otherwise the PHP installation will complain about missing libz):
xcode-select --install
4).您现在可以使用Homebrew安装PHP 7:
4). You can now install PHP 7 with Homebrew:
brew install homebrew/php/php70
这篇关于无法在macOS Sierra上使用Homebrew安装PHP 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!