$PATH when Using Passenger (mod_rails) aka BJ does work with Rails 4

Posted by Ben Reubenstein Wed, 18 Feb 2009 00:25:00 GMT

Phusion Passenger has become my default Rails setup lately. Today I had issues when using BJ on a production box, and it came down to two issues. The first was Bj not working quite right with Rails Time. The gist of that fix is to change every reference of Time.now to Time.now.utc. The next however was tougher to track down. I was getting error messages in my email:

no bj found in ["RAILS_ROOT/script", "/sbin", "/usr/sbin", "/bin", "/usr/bin"]

I jumped into the console, and ENV["PATH"] reported the correct paths, including /usr/local/bin. It turns out that passenger inherits the $PATH of apache, so I manually set the path in environment.rb and my problem was solved.

ENV['PATH'] = "#{ENV['PATH']}:/usr/local/bin"