Assuming you’re on Rails 4, have you tried:
# Feel free to add this line to e.g. ~/.bashrc so you don't have to type it all the time. export RAILS_ENV=production bin/rails console bin/rake db:version
and so on?
rails in your path may be different from the one used by your app;
bin/rails should get you the right one.