我整天都在思考这个问题。我基本上是想复制我在运行 10.11 (Yosemite) 的桌面上的设置,这样我就可以使用 Passenger 在本地环境中的 Vhost 上运行 Rails 应用程序。
因此,在新机器(笔记本电脑)上,我运行的是 macOS Sierra(10.12.2),我已经正常设置了 vhosts 和 apache,并通过 homebrew 安装了 Passenger。
现在当我运行时sudo apachectl -t
我得到:
httpd: Syntax error on line 539 of /private/etc/apache2/httpd.conf: Syntax error on line 1 of /private/etc/apache2/other/passenger.conf: Cannot load /usr/local/opt/passenger/libexec/buildout/apache2/mod_passenger.so into server: dlopen(/usr/local/opt/passenger/libexec/buildout/apache2/mod_passenger.so, 10): Library not loaded: /usr/local/opt/apr/libexec/lib/libapr-1.0.dylib\n Referenced from: /usr/local/opt/passenger/libexec/buildout/apache2/mod_passenger.so\n Reason: Incompatible library version: mod_passenger.so requires version 6.0.0 or later, but libapr-1.0.dylib provides version 5.0.0
我已经运行过了xcode-select --install
,应该没问题。命令行工具版本是 Xcode 8.2.1。
brew info passenger
给我:
passenger: stable 5.1.1 (bottled), HEAD
Server for Ruby, Python, and Node.js apps via Apache/NGINX
https://www.phusionpassenger.com/
/usr/local/Cellar/passenger/5.1.1 (3,738 files, 149.5M) *
Poured from bottle on 2017-01-09 at 16:05:11
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/passenger.rb
==> Dependencies
Required: pcre ✔, openssl ✔, apr-util ✔
==> Requirements
Required: macOS >= 10.7 ✔
==> Options
--without-apache2-module
Disable Apache2 module
--HEAD
Install HEAD version
==> Caveats
To activate Phusion Passenger for Nginx, run:
brew install nginx --with-passenger
To activate Phusion Passenger for Apache, create /etc/apache2/other/passenger.conf:
LoadModule passenger_module /usr/local/opt/passenger/libexec/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/opt/passenger/libexec/src/ruby_supportlib/phusion_passenger/locations.ini
PassengerDefaultRuby /usr/bin/ruby
输出apxs -q | fgrep -i config
APR_CONFIG=/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/apr-1-config
APU_CONFIG=/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/apu-1-config
ENABLED_DSO_MODULES=,authn_file,authn_core,authz_host,authz_groupfile,authz_user,authz_core,access_compat,auth_basic,reqtimeout,filter,mime,log_config,env,headers,setenvif,version,slotmem_shm,unixd,status,autoindex,dir,alias
看起来不错。那么我错在哪里了?