I have a PHP script that calls a Ruby script (system('ruby /lib/program.rb')
) that requires watir-webdriver. The system it's on has ruby version
ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux]
and when I check the error logs I have this message
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- watir-webdriver (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /lib/program.rb:4:in `<main>'
Requiring rubygems above does nothing. How can I fix?
See here for output when I run "by hand" and not via PHP's system function:
https://gist.github.com/anonymous/ad7befc4ca188e7b3989d6d023bcf100
require_relative
may solve requiring package. Try this:
require_relative 'watir-webdriver'
Try doing system('rvm use 2.0')
before executing the ruby script. That should ensure that the shell is using the correct version for the Ruby execution.