Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been trying to get Phusion Passenger running on 5.6 for the last couple of days with no luck. Initially, I started with Ruby 1.9.2 under RVM since the default Ruby on RHEL-based distros is quite old. I got evrything installed OK but ran into some issues. Thinking it was RVM, I completely removed it along with the default Ruby and installed Ruby Enterprise Ed. into /usr. I am still having the same issues.

When I try to Passenger with the default setup instructions provided by the installer, I get an error message saying "cannot find phusion_passenger/analytics_logger". I found very little info about this from Google but from what I can surmise it is a permissions error. Initially, I tried setting an ACL allowing user access for the apache user to the passenger root directory. Failing that, I tried chmod-ing the passeneger root to 777. Next I tried changing the context of the passenger root and its parent directory to "httpd_sys_content_t" as per section 6.3.5 of the user guide. Last, I tried setting SELinux to permissive. Nothing worked.

After reading through the user guide, I tried the following settings which resulted in a 500 ISE:

PassengerUserSwitching off
PassengerUser apache
PassengerGroup apache

Here is my passenger.conf file minus the above (from /etc/httpd/conf.d):

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.7/ext/apache2/
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.7
PassengerRuby /usr/bin/ruby
PassengerLogLevel 3

This is the log output from the 500 error:

[ pid=17939 thr=1094539584 file=ext/common/ApplicationPool/Pool.h:939 time=2011-04-30 13:12:17.351 ]: Spawning a process for /var/www/html because there are none for this app group

[ pid=17939 thr=1094539584 file=ext/common/ApplicationPool/../SpawnManager.h:291 time=2011-04-30 13:12:17.352 ]: Spawning a new application process for /var/www/html... [ pid=17939 thr=1094539584 file=ext/common/ApplicationPool/../SpawnManager.h:427 time=2011-04-30 13:12:17.352 ]: Spawn server died. Attempting to restart it... [ pid=17939 thr=1094539584 file=ext/common/ApplicationPool/../SpawnManager.h:430 time=2011-04-30 13:12:17.357 ]: Restart seems to be successful. [ pid=17939 thr=1094539584 file=ext/common/ApplicationPool/../SpawnManager.h:291 time=2011-04-30 13:12:17.359 ]: Spawning a new application process for /var/www/html... /usr/bin/ruby: error while loading shared libraries: cannot open shared object file: No such file or directory [ pid=17939 thr=1094539584 file=ext/common/ApplicationPool/Server.h:297 time=2011-04-30 13:12:17.365 ]: Client 9: SpawnException occured (no error page) [ pid=17951 thr=47853881642864 file=ext/apache2/Hooks.cpp:865 time=2011-04-30 13:12:17.366 ]: Unexpected error in mod_passenger: Cannot spawn application '/var/www/html': Could not read from the spawn server: Connection reset by peer (104) Backtrace: in 'virtual Passenger::SessionPtr Passenger::ApplicationPool::Client::get(const Passenger::PoolOptions&)' (Client.h:750) in 'Passenger::SessionPtr Hooks::getSession(const Passenger::PoolOptions&)' (Hooks.cpp:297) in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:566)

share|improve this question
up vote 1 down vote accepted

First, when you say you removed the default Ruby, I hope you aren't meaning the one that ships with CentOS. In my experience, it's best to just leave that one alone, and let yum manage it. I install my Ruby/REE versions into /opt/ruby, but they could go in /usr/local, or wherever you wanted.

As far as configuring SELinux, I personally disable it, but permissive shouldn't be any different than that. From a base install, I just add the typical packages needed for compiling packages, and do a full upgrade:

# yum -y install gcc make gcc-c++ cpp automake patch zlib-devel && yum -y upgrade

Then I install REE 1.8.7-2011.03:

# ./installer --dont-install-useful-gems --no-dev-docs --auto /opt/ruby/enterprise-1.8.7-2011.03

Make sure Apache (httpd) is installed, and then install the passenger gem, and the corresponding Apache module:

# /opt/ruby/enterprise-1.8.7-2011.03/bin/gem install --no-rdoc --no-ri --version '= 3.0.7' passenger
# /opt/ruby/enterprise-1.8.7-2011.03/bin/passenger-install-apache2-module -a

Add what it tells you, to Apache's httpd.conf. I use the following:

SetEnv MY_RUBY_HOME "/opt/ruby/enterprise-1.8.7-2011.03"
SetEnv GEM_HOME "/opt/ruby/enterprise-1.8.7-2011.03/lib/ruby/gems/1.8"
SetEnv GEM_PATH "/opt/ruby/enterprise-1.8.7-2011.03/lib/ruby/gems/1.8"
LoadModule passenger_module /opt/ruby/enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.7/ext/apache2/
PassengerRoot /opt/ruby/enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.7
PassengerRuby /opt/ruby/enterprise-1.8.7-2011.03/bin/ruby

Then, I deploy a simple Rails application to /home/httpd/app, and add a VirtualHost similar to the following:

<VirtualHost *:80>
  DocumentRoot /home/httpd/app/public
  RackBaseURI /
  RailsEnv production
  PassengerSpawnMethod smart

Make sure all the gems that your application will require are installed, including "rails".

Throughout the setup, you shouldn't have to anything too special with file permissions, other than you will have to keep in mind that your app will run as the user/group of the owner of the Rails app root. This user will have to have at least r-x permissions on all of the /opt/ruby stuff.

I honestly don't know why you are getting the /usr/bin/ruby: error while loading shared libraries: cannot open shared object file: No such file or directory error, but if you follow the above directions, and make sure not to bother with your system Ruby, you shouldn't have any problems.

I'm sorry that I didn't really answer your question, but I'm hoping my tried and trusted process will work equally as well for you as it does for myself!

share|improve this answer
Thanks walkeran. Yes I did completely remove the Ruby that came with CentOS. I figured it was safe to since nothing was actually using it and I was having issues with RVM. I'll try to integrate your settings with mine when I get home from work and see what happens. Thanks again! – Blu Dragon May 2 '11 at 17:00
@blu Funny story.. I'm not sure what planet on when I was writing that answer, but the minor "freak out" I had about messing with the Ruby from CentOS repositories was a bit unwarranted. For some reason, I was confusing Ruby with Python, and I got all concerned that yum and some other packages might just quit working...that said, I would still (personally) install it to /opt or /usr/local to avoid confusion. I'm looking forward to see how these steps work out for you, so keep us in the loop! – walkeran May 2 '11 at 20:16
It's OK. If you go anywhere near Python on CentOS it will freak out. I learned that lesson while trying to strip down my Git server. – Blu Dragon May 3 '11 at 15:42
I tried your settings and I am still getting the same error. – Blu Dragon May 3 '11 at 16:14
Nevermind; I went back to the original setup (removed PassengerUser* lines) in combination with your settings and it works now! Thank you so much! – Blu Dragon May 3 '11 at 16:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.