Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
Ruby only shows script (doesn't run)
I am a complete noob and I’m sure I’ve done something wrong, but I’m at a loss in how to make it work. I’ve written a basic “Hello World” script and put it in my /var/www/html/sites directory on Centos. I’ve followed the DO tutorial to install apache, passenger, and sinatra. Tutorial. When I go to my webpage using the ip address I get the apache welcome screen as I should. When I go to http://ip/ruby_script.rb, I get the contents of the script. I can’t seem to get the script to actually run. The script requires sinatra, so I run “ruby script.rb” at the command line before I try and hit the web page so that sinatra is running. I’m sure I’m missing a fundamental step because everything I read seems to indicate that this is a simple process. If you need more specifics to help me, please let me know. I’m feeling a little stupid because I think this should be very simple. BTW, this is the simple script I’m trying to run.
#!/usr/bin/ruby require 'twilio-ruby' require 'sinatra' get '/' do 'Hello World! Currently running version ' + Twilio::VERSION + \ ' of the twilio-ruby library.' end
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×