Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is this permissions error occurring with mod_passenger.so?

I'm setting up a production RHEL 6 server with RVM and Passenger. I've gotten through installing RVM (to my home dir), installing Passenger, and adding the required lines to httpd.conf:

LoadModule passenger_module /home/em/.rvm/gems/ruby-1.9.2-p290@rails_3_production/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /home/em/.rvm/gems/ruby-1.9.2-p290@rails_3_production/gems/passenger-3.0.11
PassengerRuby /home/em/.rvm/wrappers/ruby-1.9.2-p290@rails_3_production/ruby

But when I restart Apache I get this error...

$ sudo /sbin/service httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd: httpd: Syntax error on line 218 of /etc/httpd/conf/httpd.conf: Cannot load /home/em/.rvm/gems/ruby-1.9.2-p290@rails_3_production/gems/passenger-3.0.11/ext/apache2/mod_passenger.so into server: /home/em/.rvm/gems/ruby-1.9.2-p290@rails_3_production/gems/passenger-3.0.11/ext/apache2/mod_passenger.so: cannot open shared object file: Permission denied
                                                           [FAILED]

Experimentally, I set the whole path starting at ~/.rvm/... to 777, but I'm still getting that same error.

Any thoughts?

like image 984
Ethan Avatar asked Feb 18 '12 01:02

Ethan


2 Answers

It turned out to have to do with SELinux.

The Passenger docs discuss it here.

After you install Passenger, find the Passenger root...

passenger-config --root

Then run this...

chcon -R -h -t httpd_sys_content_t /path-to-passenger-root
like image 84
Ethan Avatar answered Oct 02 '22 17:10

Ethan


$ sudo setenforce 0

helped me

hope it help others!

UPDATE

i have to say that above solution is temporal (until reboot)

so, as far as this answer has popularity let me show how to disable SELinux at all...

here it is:

run

$ sudo vi /etc/sysconfig/selinux

or

$ sudo vi /etc/selinux/config

then find this line

SELINUX=enforcing

and change it to

SELINUX=disabled

save selinux config.

now SELinux is fully disabled.

cheers

like image 41
okliv Avatar answered Oct 02 '22 17:10

okliv