I have installed rvm (mutiuser option) and ruby using “rvm install” on my test server running Ubuntu.
If I log in and execute “ruby test.rb”, the script runs correctly.
But If I execute it using “exec” from my php code, I get an error.
If I “su www-data” and try to execute the script then I get the same error, so I guess the question is how to get “www-data” to have the correct environment to execute Ruby scripts. I’ve already tried adding “www-data” to “rvm” group and doesn’t work. If I give the full path to Ruby bin, then the script executes, but fails when requiring gems.
I’ve also tried executing a .sh where the fist line is “rvm use ruby-xxx” and the second line is “ruby test.rb” and doesn’t work either.
Should I install Ruby using “apt-get install”?
Thanks a lot.
Hm, I don’t know about multi-user version, but if you were running a single user version, you could run scripts as that user, like this:
See this question and answers.