2016-09-21 31 views
5

Tôi đang cố gắng để thiết lập Valet Laravel của đó, như một sự phụ thuộc, đòi hỏi PHP 7. Khi tôi cố gắng để cài đặt PHP 7 với Homebrew tôi nhận được lỗi sau:Không thể cài đặt PHP 7 với Homebrew trên hệ điều hành MacOS Sierra

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 

Đây là bản cài đặt mới của macOS Sierra (bản phát hành thực tế, không phải bản beta) với cài đặt Homebrew mới (đã cập nhật). Tôi đã cài đặt, chạy và đồng ý với thỏa thuận cấp phép Xcode.

Tôi không biết ý nghĩa của những lỗi này hoặc cách khắc phục chúng. bất cứ ai có thể cung cấp bất kỳ sự giúp đỡ?

Cảm ơn.

Trả lời

9

Tôi đã tìm ra. Tôi đang đăng các bước để cài đặt thành công các thành phần yêu cầu bên dưới trong trường hợp bất kỳ ai khác tình cờ gặp vấn đề này:

1). đảm bảo Homebrew được cập nhật:

brew update 

2). Sửa lỗi PHP 7 bằng cách đảm bảo Xcode được cài đặt và sau đó nhập thông tin sau vào 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). Chạy lệnh sau (nếu không cài đặt PHP sẽ khiếu nại về thiếu libz):

xcode-select --install 

4). Bây giờ bạn có thể cài đặt PHP 7 với Homebrew:

brew install homebrew/php/php70 
1

Tôi đã sử dụng các lệnh sau để làm cho nó hoạt động.

brew tap homebrew/dupes 
brew tap homebrew/versions 
brew tap homebrew/homebrew-php 
brew update && brew install apr apr-util 
brew link apr-util --force 
brew link apr --force 
which apu-1-config 
which apr-1-config 
sudo mkdir -p /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/ 
sudo ln -s /usr/local/bin/apu-1-config /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/ 
sudo ln -s /usr/local/bin/apr-1-config /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/ 
brew install php70 
2

Nó cũng có thể quan trọng đối với những người sử dụng cài đặt hệ điều hành MacOS-giao của Apache với PHP qua Homebrew rằng (trích dẫn từ php70 Homebrew cài đặt):

Với việc phát hành hệ điều hành MacOS Sierra module Apache tại là không được xây dựng theo mặc định. Nếu bạn muốn xây dựng nó trên hệ thống của bạn, bạn phải cài đặt php với tùy chọn --with-apache. Xem tùy chọn brew php70 để biết thêm chi tiết.

+0

Tùy chọn --with-apache hiện không được dùng nữa, hãy sử dụng --with-httpd24 để thay thế –

Các vấn đề liên quan