SitePoint Sponsor

User Tag List

Results 1 to 20 of 20

Hybrid View

  1. #1
    $books++ == true matsko's Avatar
    Join Date
    Sep 2004
    Location
    Toronto
    Posts
    795
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    can ruby be a substitute for php?

    I really dont know anything about ruby other than its a multi purpose language like perl. However I was wondering if it could be used for http request parsing like php can. Even thou php is a most suitable choice since it designed for http jobs, it still would be interesting to use it for that task...

    I am aware that you can build apache with mod_ruby support, however I just dont know where it comes into usage...
    I can't believe I ate the whole thing

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    There are a few web-enabled frameworks for Ruby. There's plain old Apache + mod_ruby, you can run Ruby as CGI, or you can use a more complete framework like Ruby on Rails or Nitro.

    Ruby can do just about anything PHP can. It's not a one-to-one replacement for every aspect of PHP, and support among web hosts isn't as big as it is for PHP, but it's a nice language to develop in.

  3. #3
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://wiki.rubyonrails.com/rails/pages/mod_ruby
    mod_ruby uses a shared interpreter per Apache process, which means that multiple Rails applications on the same Apache setup with mod_ruby would share the framework classes. This doesn’t work well with the Rails model of using class-level configuration attributes, so it’s considered unsafe to use mod_ruby and Rails with more than one application running per Apache setup, because different applications may start sharing the classes.

    To overcome this, use a special dispatcher by Shugo Maeda (the author of mod_ruby) ...
    People don't seem to use mod_ruby much. I don't know if it is because of the above, sufficiency of fcgi, or preference for lighttpd. :shrug:
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  4. #4
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    California
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ruby is great but as for replacing PHP? I don't know. I still use PHP for quick&dirty scripts since I can just drop then in a directory and go to them and they work. Ruby is the same way but its not that easy to create a web page that way

  5. #5
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by xmichx
    Ruby is the same way but its not that easy to create a web page that way
    Why ?
    Up until now I haven't used Rails much, but I have been using Ruby for quick CGI scripts, and it's OK.

  6. #6
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I really recommend Ruby on Rails for everything but the most simple things (email-forms, etc). You'll save a lot of time by using it.

    http://www.rubyonrails.org/

  7. #7
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rails is well rounded, and easy to use and is so much nicer than PHP for anything that involves more than including a header and footer as a rule of thumb

  8. #8
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    BTW, I would avoid mod_ruby, it can leave stale data between requests, and it's not exactly stable. If you use Rails, you want to use lighttpd and FCGI (or SCGI if you want to live on the edge). If you still need Apache, use the proxy module in either webserver to get them to run alongside. If bother webservers are on the same PC, you'll need to give one a different TCP port like 8080. While the mod_proxy thing sounds like a chore, it's dead easy to do, and you can't go wrong.

    If you use Linux, I suggest you use Gentoo. Portage makes it easy to get up and running... by slapping up your USE flags right, it saves you a lot of time playing with ./configure switches

  9. #9
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One thing I recommend is not to get caught up in the lighttpd hype. Apache 2.0 + mod_fcgi works very well. I have serious doubts about the Apache benchmark results at http://litespeedtech.com/benchmark.html I've already run a few of them through a new VPS and my Apache static scores are about 1.5 times higher than the benchmarks at the litspeedtech site. I will be publishing the results end of this week or early next week on my blog. I've used Apache for a long time so I'm not so quick to just give it up based on a few benchmarks. I'm using 2.0.52 and will be testing Apache 2.2 soon.

    Paul Querna has a nice debunking article at http://paul.querna.org/journal/artic...ttpd?postid=82
    and that was with Apache 2.1alpha. However I don't agree with his idea of just grabbing a random page from slashdot so that others can't use the same test criteria.

    If you use Linux go with the distro you know best. I really hate Gentoo and prefer Debian and CentOS anyday.

  10. #10
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I sure hope Ruby beats the crap out of PHP. :P

    Not because PHP is a bad language, but because it has become the beginner language of choice, and I really don't think it's that good of a beginner language.
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  11. #11
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by M. Johansson
    Not because PHP is a bad language, but because it has become the beginner language of choice, and I really don't think it's that good of a beginner language.
    It's a good language to get people interested in programming, but it's very hard to move out of that "beginner" mindset and into higher-order coding practices. It reminds me of Visual Basic in that way (and we all know Microsoft is trying to wean everyone off of VB and on to C#).

  12. #12
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by M. Johansson
    I sure hope Ruby beats the crap out of PHP. :P

    Not because PHP is a bad language, but because it has become the beginner language of choice, and I really don't think it's that good of a beginner language.
    I have two other reason why I'd like to see Ruby beat the crap out of PHP

    1. The legacy of sloppy, poorly written PHP webapps starting with the dreadful PHPNuke and all its craptastic forks. Take a peek at the RoR typo blogger and it's beautiful code -- easy to read, easy to modify for your own needs.

    2. Because I'm sick of the LAMP acronym. While I love Linux and Apache there's more to life than the M and P.

  13. #13
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kuato
    The legacy of sloppy, poorly written PHP webapps starting with the dreadful PHPNuke and all its craptastic forks. Take a peek at the RoR typo blogger and it's beautiful code -- easy to read, easy to modify for your own needs.
    This is kind of unfair since the legacy of sloppy, poorly written PHP webapps you talk about have a lot to do with PHP being popular.
    Currently, beginners don't have much of an interest in Ruby, but when that will happen, Ruby will suffer from the same thing.


    And I have a very cool quote for you guys, by Bjarne Stroustrup, of which I found out in a blog by Harry Fuecks:

    "There are only two kinds of languages: the ones people complain about and the ones nobody uses"

  14. #14
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bonefry
    This is kind of unfair since the legacy of sloppy, poorly written PHP webapps you talk about have a lot to do with PHP being popular.
    Currently, beginners don't have much of an interest in Ruby, but when that will happen, Ruby will suffer from the same thing.
    People beginning with Ruby are generally using Rails, which by no coincidence of language railroads you into several decent coding habits.

    In contrast, PHP is quiet the blank slate.

    There are still plenty of mistakes to make in Rails, I'm sure I make many, but it does encourage some basic good practices (like model - view separation).

    * I have a theory that many people are beginning with Rails, though it is difficult to notice because they are almost immediately as proficient as someone who has used PHP for a year.
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  15. #15
    throw me a bone ... now bonefry's Avatar
    Join Date
    Nov 2004
    Location
    Romania
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by samsm
    * I have a theory that many people are beginning with Rails, though it is difficult to notice because they are almost immediately as proficient as someone who has used PHP for a year.
    or because you simply can't find Rails programmers in general ... very difficult to notice

  16. #16
    SitePoint Member
    Join Date
    Jan 2004
    Location
    Continente de São Pedro
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have developed for years with PHP, but Nitro has amazed me. It's multi-paradigm framework, so I use it to complex webapps or simple PHP-ish scripts!

  17. #17
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    RubyOnRails is good for database applications as mentioned on RubyOnRails intro page. but what about others things like "Image Generation using GD","Sockets", "FILE IO","HTTP library like CURL" , and a lot of other functionalities php provides...?

    forexample i can build webservices/web-crawlers in PHP in some minutes and can create images/flash animations on fly..

  18. #18
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by cyrenity
    RubyOnRails is good for database applications as mentioned on RubyOnRails intro page. but what about others things like "Image Generation using GD",
    RMagick
    Quote Originally Posted by cyrenity
    "Sockets",
    Built into Ruby's standard library
    Quote Originally Posted by cyrenity
    "FILE IO",
    Again, built into the standard library
    Quote Originally Posted by cyrenity
    "HTTP library like CURL"
    Standard library again
    Quote Originally Posted by cyrenity
    , and a lot of other functionalities php provides...?
    Read the links above. Thanks for playing!
    Quote Originally Posted by cyrenity
    forexample i can build webservices/web-crawlers in PHP in some minutes and can create images/flash animations on fly..
    Action Web Service

    Yes, Ruby can do anything that PHP or nearly any other programming language can.

  19. #19
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Flash generation with ruby:

    http://svn.xeraph.org/trac/flash-ruby


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •