Posted at

httpd.confがpassenger-6.0.2のパス周りでエラーを起こしたとき


エラー

~~~/gems/passenger-6.0.2/buildout/apache2/mod_passenger.soあたりが変だよと怒られる。

$ apachectl configtest

httpd: Syntax error on line 176 of /private/etc/apache2/httpd.conf: Cannot load /Users/{ユーザー名}/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/passenger-6.0.2/buildout/apache2/mod_passenger.so into server: dlopen(/Users/{ユーザー名}/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/passenger-6.0.2/buildout/apache2/mod_passenger.so, 10): no suitable image found. Did find:\n\t/Users/{ユーザー名}/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/passenger-6.0.2/buildout/apache2/mod_passenger.so: stat() failed with errno=13


解決した方法

単純にmod_passenger.soまでのパスが変だったんでそこを直したら解決した。


passengerを入れ直し

ここではエラーは起きなかった。

$ gem install passenger

Fetching rack-2.0.7.gem
Fetching passenger-6.0.2.gem
Successfully installed rack-2.0.7
Building native extensions. This could take a while...
Successfully installed passenger-6.0.2
Parsing documentation for rack-2.0.7
Installing ri documentation for rack-2.0.7
Parsing documentation for passenger-6.0.2
Installing ri documentation for passenger-6.0.2
Done installing documentation for rack, passenger after 97 seconds
2 gems installed


passenger-install-apache2-moduleをし直す

$ passenger-install-apache2-module

Welcome to the Phusion Passenger Apache 2 module installer, v6.0.2.
(略)
* Checking whether Apache is installed... ✓
* Checking whether the Passenger module is correctly configured in Apache... ✗

Incorrect Passenger module path detected

Phusion Passenger for Apache requires a 'LoadModule passenger_module'
directive inside an Apache configuration file. This directive has been
detected in the following config file:

/private/etc/apache2/httpd.conf

However, the directive refers to the following Apache module, which is wrong:

/Users/{ユーザー名}/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/passenger-6.0.2/buildout/apache2/mod_passenger.so

Please edit the config file and change the directive to this instead:

LoadModule passenger_module /usr/local/var/rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/passenger-6.0.2/buildout/apache2/mod_passenger.so

Detected 1 error(s), 1 warning(s).
Please solve the above issues, then press ENTER to continue.

終わったと思って、よく読んでみるとエラーが。

親切にも/private/etc/apache2/httpd.confっていうファイルの中のこのパスが間違っているからこっちに直してね。と詳しく教えてくれています。

ここは素直に言われたとおり

LoadModule passenger_module /usr/local/var/rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/passenger-6.0.2/buildout/apache2/mod_passenger.so

と書き換えて解決でした。めでたしめでたし。