Welcome to Grapethinking

Grape Thinking is a lifestyle that enhances enjoyment and pleasure while connecting people to their environment.

We offer millennial marketing and technology development services to everyone from the grape grower to the eco-capitalist.

Featured Client

  • Getting Rails to Work on a Windows Machine Running Xampp

    Wow… so I wrote a post on my struggles getting Rails to work on my Windows Machine, and then I figure it out. I’ve been developing in various languages, and using Xampp to for my server, database, and programming language (Apache, MySQL, PHP). Nevertheless, I have finally got it working, and it was a lot simpler than I had figured. In case you’ve come here and you’re yet to get Xampp… I’ll walk you through the whole process. If you already have it, then go ahead and skip to STEP 2

    STEP 1 – Install Xampp – ApacheFriends has made it really easy by giving us a simple windows installer to download. If your interested in developing with Perl, Tomcat, you can download their Add-Ons by clicking the links. Once you download, just give it a click and follow the on-screen instructions. I recommend you install Xampp at the default c:\xampp (if you do not, remember to replace the code below with your installation directory). Here’s a video to show you how simple it is…don’t be fooled, it takes a little longer than the video shows.


    STEP 2 – Install Ruby – Thanks to RubyForge, you can download an easy one-click Ruby installer to use here. Once you download, click to open, and follow the instructions. I recommend you install Ruby at c:\xampp\ruby so it falls in line with your other programming languages, etc…

    STEP 3 – Install Rails – Fortunately, the Windows version of Ruby comes with RubyGems already set up. Open your Command Prompt (start-> run-> cmd -OR- start-> programs-> accessories -> command prompt) and type the following commands.

    Do the gem update from the bin directory in rails. For my installation:

    cd c:\ruby\bin
    gem update
    You may be prompted several times to choose which gem. Pick the highest version for (mswin32)
    gem install rails --include-dependencies

    There may be some delays, and the install could take a while. If you encounter an error trying to use the gem command, just restart the Command Prompt.

    STEP 4 – Create a Rails App – While your still in Command Prompt, type the following Command (without the brackets, and change “your-app-name” to whatever you wish to call your application)

    rails C:/xampp/htdocs/<your-app-name>

    STEP 5 – Configure Apache – With your Xampp installation, http://localhost (localhost:80) defaults to the Xampp browser control panel, which displays your status, tests, etc.. We want to be able to use Ruby, without disrupting this service, or interfering with our standard Xampp settings. Open your Xampp directory (in our case C:\Xampp) and browse to Apache\conf\httpd.conf and open the httpd.conf file in a text editor or other text editor of your choice.

    Scroll all the way to the bottom, and add the following:

    Listen 3000
    LoadModule rewrite_module modules/mod_rewrite.so
    #################################
    # RUBY SETUP
    #################################
    <virtualHost *:3000>
    ServerName rails

    DocumentRoot "c:/xampp/htdocs/<your-app-name>/public"
    <Directory "c:/xampp/htdocs/<your-app-name>/public/">

    Options ExecCGI FollowSymLinks
    AllowOverride all
    Allow from all
    Order allow,deny
    AddHandler cgi-script .cgi
    AddHandler fastcgi-script .fcgi

    </Directory>
    </VirtualHost>

    #################################
    # RUBY SETUP
    #################################

    Finally – Check it Out – Point your browser to http://localhost:3000 and you should see the “Welcome Aboard” from ROR.

    If your also looking for some editors. A nice simple free PHP editor with great extensions is “PSPad“. For hardcore coding, I recommend Zend(free for 30 days). For a nice simple free Rails Editor, “RoRED“, something a little more intense I would say go with the free “NetBeans” (don’t forget the .jdk).


    Update 04/15/09

    I now dual boot to Linux to play with ROR vs. fighting to install ruby on rails on a windows machine. I found it to be an endless battle of debugging.

    Tags: linux, php, programming, rails, ror, ruby on rails, Technology, tutorial

    Related posts

    Comments

    1. Installing Ubuntu and Rails on Virtual PC 2007 | Grape Thinking Said,

      [...] I finally got it working on Windows – check it out)[...]

    2. Jake Said,

      Some comments for this post started popping up in a thread on another post.. if your having any problems you might want to also check here

    3. hafreze Said,

      thanks for the guideline..have some troubles while installing ruby with xampp..

    4. hafreze Said,

      a problem occured, after I add the the syntax in httpd.conf, and I restart the apache, it cannot runs well. then, i remove the syntax, apache runs well. how to solve it?

    5. Jake Said,

      Sorry hafreze… I just went back over everything… there was a missing “>” at the end of the Directory line… /public/”>

      If you copy and paste the info now, everything should work fine for you!

    6. Geshan Said,

      I got it working but am stuck in database selection with production, dev and test. I found one small mis-pointer in your blog post :

      “Open your Xampp directory (in our case C:\Xampp) and browse to Apache -> httpd.conf and open the httpd.conf file in a text editor or other program editor of your choice.”

      its should be \xampp_folder\apache\conf\httpd.conf file.

      Geshan

    7. jake Said,

      @Geshan.. thanks for pointing that out… I’ll be sure to update the post.

      If you are running Xampp, then you want to make sure you set the rails config for mysql database. You want multiple databases for prod. dev., and test… I just created for my 3.

    8. hafreze Said,

      after all, the configuration for rails in xampp is working..thanks jake. By the way, as what Geshan had stated, the default database for rails is sqllite3. I would like to use the mysql in xampp as my database, is it possible to do that?

    9. Jake Said,

      @hafreze

      Yes, in the new Ruby, its as easier as changing adapter: sqlite to adapter: mysql in the config/database.yml

    10. hafreze Said,

      oh really?!..I read at other forum in which they stated about the usage of socket..is it necessary? MYSQL_SOCKET_LOCATIONS = [ ”/tmp/mysql.sock”, #default ”/var/run/mysqld/mysqld.sock”, #debian/gentoo ”/var/tmp/mysql.sock”, # freebsd ”/opt/lampp/var/mysql/mysql.sock”, # xampp ”/var/lib/mysql/mysql.sock” , #fedora ”/Applications/xampp/xamppfiles/var/mysql/mysql.sock”] #xampp on osx

      if needed, how could i correctly configure that?

    11. hafreze Said,

      ok..i figure out on how to change from sqllite 3 to mysql..we should change the config/database.yml file

      # SQLite version 3.x
      # gem install sqlite3-ruby (not necessary on OS X Leopard)
      development:
      adapter: mysql
      encoding: utf8
      database: temp_development
      username: root
      password:
      socket: /tmp/mysql.sock

      # Warning: The database defined as ‘test’ will be erased and
      # re-generated from your development database when you run ‘rake’.
      # Do not set this db to the same as development or production.
      test:
      adapter: mysql
      encoding: utf8
      database: temp_test
      username: root
      password:
      socket: /tmp/mysql.sock

      production:
      adapter: mysql
      encoding: utf8
      database: temp_production
      username: root
      password:
      socket: /tmp/mysql.sock

      after that, go to phpmyadmin and create database with the name of ‘temp_development’

    12. f00f Said,

      hey you said to use Zend as a Ruby on Rails editor… but it doesnt pick up the files i think it’s specifically for PHP. How do i go about this ?

      madd nubb! :P

      -f00f

    13. Jake Said,

      PHP: I was recommending Zend for the hardcore coding, and pspad for the simple editing.

      Ruby: I was recommending Netbeans (don’t forget the jdk) for the more advanced ruby editing, and rored for simple ruby editing.

    14. Ruby on Rails « ಠ_ಠ Said,

      [...] on Rails I initially tried to install Ruby/Rails into XAMPP using this guide. The initial steams worked fine, but using gem to install rails wouldn’t work. Some googling [...]

    15. Peri.me » Blog Archive » Installing Ruby on Rails (ROR) with XAMPP Said,

      [...] Getting Rails to Work on a Windows Machine Running Xampp [...]

    16. chicago web design Said,

      Can you describe the performance difference? Is it much faster to use XAMPP than to use Webrick or Mongrel?

    17. Jake Said,

      I’m not sure of a performance difference.. though if your interest is solely in running rails, and you aren’t concerned with php.. you’re best bet would be to go with webrick, and ignore xampp altogether.

    18. Dick Said,

      Did your tutorial, but it does not work. I have got the “welcome aboard” screen (that is in html so that works) but XAMPP (Apache server) can not handle Ruby coding. Made a new controller and it could not found the page.

    19. Walfried Said,

      I get the ‘“Welcome Aboard” from ROR’, but I am not able to get the rails/info/properties. Any help is appreciated.

    20. misyn Said,

      @Dick I’m having the same problem. I get the welcome aboard but hitting a test page (e.g. http://localhost:3000/say/hello) returns a 404, Object not found! error.

    21. Deep Said,

      I cant able to run .rb file through this way , anybody can help me how to run .rb file on http://localhost:3000

    22. links for 2009-03-31 « Skywalker Said,

      [...] Install Xampp and Rails on a Windows Machine 在Xampp上安装Ruby (tags: Ruby) [...]

    23. DMA Said,

      Hi
      I have followed the above step but getting the following error when I goto http://localhost:3000 and explore the “About your application environment”

      Object not found!

      The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

      If you think this is a server error, please contact the webmaster.
      Error 404
      localhost
      04/15/09 12:55:55
      Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.6

      Thanks in advance.

    24. Jake Said,

      Hi DMA.. sorry I did not update the post sooner. I gave up on using rails on a windows machine. I now do all of my rails work by dual booting to linux. It was definitely worth it!

    25. DMA Said,

      Hello Jake, I have seen same instructions in other places, so this should work fine but why is not working I dunno. Is there anyone who has used in windows machine??

    26. Wow.. just WOW Said,

      Jake. While I appreciate your attempt at trying to help windows users install RoR, I just spent over an hour installing and troubleshooting according to this guide, just to find you saying in Comment 24 that you “gave up”????

      If this guide does not work, PLEASE TAKE IT DOWN. While u were doing a great service with good intentions, the fact that you’re misleading people is now a great disservice.

    27. jake Said,

      Hi Wow… while I understand your frustration, please note that the guide works for getting rails up and running to “Hello World”, but there are a ton of other issues that arise (as I’m sure you’ve discovered) once you start developing your app.. this is why there is a bold section in the post with the update that I no longer use rails in windows… in addition to comment 24.

    28. fizza Said,

      Unable to connect http://localhost:3000 . I cannot connect to localhost. I put already
      Listen 3000
      LoadModule rewrite_module modules/mod_rewrite.so
      #################################
      # RUBY SETUP
      #################################

      ServerName rails
      DocumentRoot “c:/xampp/htdocs//public”
      <Directory "c:/xampp/htdocs//public/”>

      Options ExecCGI FollowSymLinks
      AllowOverride all
      Allow from all
      Order allow,deny
      AddHandler cgi-script .cgi
      AddHandler fastcgi-script .fcgi

      #################################
      # RUBY SETUP
      #################################

    29. Greasy Said,

      Got this to work on Vista SP2 first time!
      nice action

    Add A Comment

    Contact Us |  RSS