In your case you'll want to modify your Apache httpd.conf file to change
And then create the file
/usr/local/bin/ruby_with_env with these contents:
Then make sure to do
chmod 755 /usr/local/bin/ruby_with_env so the wrapper script is executable and then tell Apache to reload its configuration.
Also, this of course presumes you have ruby installed in
/usr/bin, but if you have it in another location you'll want to change the line to either
/path/to/ruby $* or the more general
/usr/bin/env ruby $* which will search in Apache's path for ruby.
The discussion entitled Setting umask for rails user suggested a similar solution:
> I'd like to set umask to 002 for the user running the rails processes.
> However, passenger ignores the value set in ~/.profile (or set in
> environment.rb via File.umask).
I would set it in a wrapper script that sets enviroment stuff and then
invokes ruby; use this wrapper script as the target of your
PassengerRuby/RailsRuby parameter. See this blog post for an example: