no such file to load -- config/environment - Apache2 & Passenger 2.1.1

i recently started using Ruby and Ruby on Rails. For Development i'm
using RadRails and InstantRails on my local Windows machine.

Atm i'm trying to get a basic application running on Ubuntu Server
8.10 with Apache 2.2.9 & Phusion_Passenger 2.1.1.
Frist i tried to get just the app-sceleton generate by RadRails to
work (which worked fine on InstantRails) and the i tried the same with

In both cases i recieve the following error:

no such file to load -- config/environment

When trying to get the basic application running i see the Welcome to
Aptana RadRails page but when following "About your application’s
environment" i get the mentioned message. Same after installing typo
and going to admin page for first time.

The passenger backtrace is:
0 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb 31 in
1 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb 31 in
2 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
railz/application_spawner.rb 267 in `preload_application'
3 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
railz/application_spawner.rb 227 in `initialize_server'
4 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
utils.rb 211 in `report_app_init_status'
5 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
railz/application_spawner.rb 216 in `initialize_server'
6 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
abstract_server.rb 180 in `start_synchronously'
7 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
abstract_server.rb 149 in `start'
8 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
railz/application_spawner.rb 192 in `start'
9 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
spawn_manager.rb 260 in `spawn_rails_application'
10 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
abstract_server_collection.rb 121 in `lookup_or_add'
11 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
spawn_manager.rb 254 in `spawn_rails_application'
12 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
abstract_server_collection.rb 75 in `synchronize'
13 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
abstract_server_collection.rb 74 in `synchronize'
14 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
spawn_manager.rb 253 in `spawn_rails_application'
15 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
spawn_manager.rb 148 in `spawn_application'
16 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
spawn_manager.rb 285 in `handle_spawn_application'
17 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
abstract_server.rb 332 in `__send__'
18 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
abstract_server.rb 332 in `main_loop'
19 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/lib/phusion_passenger/
abstract_server.rb 182 in `start_synchronously'
20 /usr/lib/ruby/gems/1.8/gems/passenger-2.1.1/bin/passenger-spawn-
server 46

I installed the following gems:

actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activeresource (2.2.2)
activesupport (2.2.2)
cgi_multipart_eof_fix (2.5.0)
coderay (0.8.312)
columnize (0.3.0)
daemons (1.0.10)
datanoise-actionwebservice (2.2.2)
eventmachine (0.12.6, 0.12.4)
fastthread (1.0.1)
flexmock (0.8.5, 0.8.4)
gem_plugin (0.2.3)
htmlentities (4.0.0)
json (1.1.3)
linecache (0.43)
mysql (2.7)
passenger (2.1.1, 2.0.6)
rack (0.9.1)
rails (2.2.2)
rails-app-installer (0.2.0)
rake (0.8.4, 0.8.3)
rspec (1.1.12)
rspec-rails (1.1.12)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3)
sqlite3-ruby (1.2.4)
will_paginate (2.2.2)

In both cases i chowned the appbase and the tmp dir to the apache user
all other files are owned by the owner of environment.rb

Thanks for your help in advance

try here:

Basti כתב:

Change the owner and group of the environment.rb file to the user and group of your apache2 instance (probably www-data). See if that helps.



I have the same problem, and the owner:group is root:www
changing to www:www seems to only make things worse and i don't even
get the passenger error page.
do you have any other idea?

i use:
Rails 1.2.3
passenger 2.1.2
Apache/2.0.52 (CentOS)

: ok, solved for me.
it is very important to read section 8.1 in the user guide:

and also to remember set the correct RailsEnv in the conf file.

we went with:

PassengerUserSwitching off
PassengerDefaultUser www
RailsEnv something_that_is_not_production

Yes, CentOS is different than ubuntu. You had said at the beginning that you were running ubuntu.