PHP vs Rails a debate run by giltotherescue

1 - I can do better 2 - Jury's out 3 - Pretty darn good 4 - Splendiferous 5 - Awesometastic (by 16 people)   Your rating: 1 - I can do better 2 - Jury's out 3 - Pretty darn good 4 - Splendiferous 5 - Awesometastic

I Confess, I'm In Love With PHP

 

PHP vs Rails



I know it's not fair, but neither is life. PHP is a language and Rails is a framework. How can one go about comparing them?

The fact that it isn't an apples to apples comparison doesn't stop people (including myself) from throwing them into the ring for a deathmatch.

Although I spend a significant portion of my day talking to Rails developers, I still prefer PHP. In fact, this site is built on it. I understand the Rails philosophy of helping developers write good code by forcing them to use a structured framework, but the more advanced an application becomes the more difficult it becomes to work within that structured framework.

In addition, Rails performance is a major issue. Many people argue that development is faster with Rails, a factor which offsets the additional hardware costs, but this still has yet to be proven. I will definitely agree that prototyping is faster in Rails, but extending an existing Rails application (to replace the framework's default feature set) becomes more cumbersome as the application grows larger.

The Rails Guy 

Ruby on Rails vs PHP - RailsEnvy.com Commercial #4

Gregg Pollack and Jason Seifer from RailsEnvy.com do some Ruby on Rails commercials in the same style of the Mac vs PC ads. Videos produced by Jason Hawkins of MakeFilmWork.com.

Runtime: 1:19
67614 views
10 Comments:

powered by YouTube

Points of View 

PHP vs. Rails - concrete examples
From the Joel on Software Discussion Group
Clickable Bliss Blog ยป PHP vs Ruby on Rails, Part 1
Musings from an independent developer, Cocoa, Rails, and UI for the most part.
Rails vs. PHP: MVC or view-centric
David Megginson's weblog about technology, especially XML and web architecture.
Why PHP vs Rails?
An unbiased analysis
PHP vs Ruby - Practical Language Differences
Another unbiased analysis

On Frameworks 

Frameworks offer a major advantage by forcing you to make less decisions, theoretically meaning that you a) produce code faster, and b) produce better code because you follow established principles.

The problem is that it's possible to outgrow a framework. If you become too comfortable in the framework itself, you'll either not understand how to extend it, or struggle with resistance to change.

Let me give you an example. Rails prides itself on being "database agnostic," meaning you can take the same application and run it on Oracle, MySQL, SQL Server, etc. By the same token, that also means you aren't able to take advantage of some of the benefits of each of those databases. It's like designing a web site only in images because browsers don't always support the same HTML and Javascript sytnax. Most projects never require a database platform migration, and extending Rails to support platform-specific features requires extra effort.

But that's just one example. PHP offers many Rails-like frameworks such as Zend Framework and CakePHP which quite possibly suffer from the same affliction. I'm not suggesting that frameworks are bad, merely that one should be mindful of the tradeoffs in using one.

What Do You Think? 

Loading poll. Please Wait...

Fight It Out 

PHP is better than Rails

Loading Fetching blurbs now... please stand by

Yes, PHP is better!

4x4ever says:

Comment #2 (first one was in the Ruby section): I dunno if PHP is better - never used it but I have been learning Drupal (in my spare time, since early Feb) and I can put up a pretty full-featured and nice looking web-site in no-time. You may check fxsoftwaresolutions.com - my first Drupal web-site, not too much content yet but you can see the functionality. Drupal is based on PHP and did do some PHP coding for this site. I come from a C++/Java background and PHP strikes a cord with me as it resembles these languages (syntax-wise).

RyanRE says:

I have never used Rails, but I have learn a bit of php. I mostly learned php to customize some wordpress blogs. It is not too difficult to learn once you have a strong understanding of HTML.

CNSQ says:

PHP is better because it has a greater support community and the apache servers available supports PHP by default. Rails is great there are no free webhosting services that supports them where people could "test" their web apps without paying for hosting Rails

JaguarJulie says:

First time I've heard about PHP! But, because YOU think it's better, I'm definitely SURE it is!!! AB

Music-Resource says:

PHP is better today. Rails may be better at a later date. As stated, documentation and support is currently lacking for rails. Though I started out self-taught in the 80's, I have since had formal training. I've been leaning more and more towards best practices, standards, and structure. If rails catches on a bit more, I'm sure it will be superior. I hate goto statements (except for managing errors) and spaghetti code in general, so structure is very appealing to me. Even so, PHP is king for now.

giltotherescue says:

@Paul: Sure, but Wordpress would've never made it to the mainstream if it were written in Rails. How many hosts offer Rails in a shared hosting environment? Also, I didn't say that it was impossible to use database-specific features in a Rails app...I said it requires extra effort. That means programmers are less likely to develop a well rounded skill set.

Macky says:

When i think about writing an application in PHP, i KNOW that it has already been written somewhere... better!!! Can't really say the same for Rails... but then again, i DON'T look...

Tom says:

Ruby has a horrible compiler, PHP has a horrible standard library. One of those is easier to hack a fix for than the other (hello PHP frameworks)... I still avoid using either.

Simon says:

What about using the Zend Framework to keep MVC? I want to use it in my next project. I can't say much about Rails since I have not used it...yet!

garethjax says:

Ruby is still too young to stand a chance about the wealth of articles and people who support and use php... but it's good that there's an alternative. And i didn't know about cakephp, today i've learned something new :)

thefluffanutta says:

I really like PHP, mainly because of the C syntax coupled with the ease of scripting. However, it can be a challenge to write neat code sometimes, and there are some really bad examples out there. I get over this by using a template engine like Smarty.

I haven't tried Rails, nor can I find the time or opportunity to. I have found a web development platform that does everything I need it to do, and I'm happy with it.

Stubbs says:

There's no option for "This fence is hurting my ass crack, I like both"

giltotherescue says:

@theben: I appreciate your input. There's certainly a lot of Rails-inspired thinking that goes into Squidoo itself, and Rails has been an insanely positive influence on the entire industry.

Where I'm a little torn is if for some reason you aren't totally able to confirm to The Rails Way (specifically, the DHH way), it seems like the effort to climb out of the framework can become frustrating. In training a programmer to think a certain way, are we also training them to not recognize other options?

Nick Manley says:

I've never done Rails development so it wouldn't be fair for me to make outright claims about it, but what I do know is that there is nothing stopping someone from using MVC or something like CakePHP or CodeIgnitor in PHP to do the same type of development that is done in Rails. Plus PHP is more widely supported by hosting companies and more applications are written in it.

coreybrown says:

I once wanted to learn Rails, but found way more documentation for PHP, and more places to host and practice.

giltotherescue says:

PHP is more widely supported among web hosts than any other scripting language. It features one of the best online training and references manuals of any language in existence. A robust open source community has sprung around PHP, including mainstream apps such as WordPress, vBulletin, punbb, and phpMyAdmin.

No chance. Rails is amazing!

4x4ever says:

Actually, Seth, PHP is a completely legal drug :) ... as in, yes, it is addictive. I like it quite a bit and so I really shouldn't be posting on this side but since I want to "pun" Seth and since the Rail guys seem to be at disadvantage, plus, as chaostheory pointed out one shouldn't comment unless one has experience with both (and I don't) - I think it's ok if I post here. Then I'll try posting on the left side and if squidoo allows me will file one more bug report for Seth's collection :P

Paul says:

Wordpress is an excellent example of where PHP goes wrong. Customizing Wordpress has been a pain in the ass -- and my server uses Postgres, so I have to work off somebody's bastardized fork of the code.

If Wordpress were written in Rails, it would just work with both databases, and there would be a much clearer customization mechanism that didn't require so much forking.

(Incidentally, the article is wrong: you can ABSOLUTELY use DB-specific queries and features. You just don't HAVE to all the time!)

True, there are DB-agnostic frameworks out there for PHP, but if I'm investing in a framework, I'd rather make it one that uses a great language. PHP appeals only out of familiarity bias. As a language, it's a nasty mishmash of ideas with no central strength. Its OO is a hoax. Ruby's Smalltalk heritage gives it a kind of depth and consistency that PHP just doesn't have.

Codey says:

Ruby's syntax keeps me with Rails. There are many virtual machines in development that should solve the speed issues that are currently holding back many Ruby projects. I'm vehemently opposed to semicolons.

Robert Dempsey says:

I developed in PHP for many years before moving to Rails. While I prefer Rails (and have a Rails shop and a not-for-profit educating people about Rails), the choice of language (or framework) is both a matter of what works best for the problem you are trying to solve as well as preference. If we can step off of the playground for a moment then I think we can agree to disagree.

theben says:

As someone who's done extensive work in both (including a little PHP you may not know you've used :), I'm firmly in the Rails camp. Before I was able to use Rails full-time, I ported concepts from it into my PHP. I'm both happier and more productive using it. It's no contest for me.

That said, every technology has its sweet spot. If you're stuck on crappy shared hosting and don't mind the inconsistent interfaces, tacked-on "OO," and all-around ooginess of PHP, go for it.

Winfred says:

If you prefer PHP then Ruby has an equivalent (but superior) technology. It's called erb. If you already know php, you can just write erb templates that look just like PHP file. Plus you get an actual object oriented language in case you want to use objects.

Rails goes far beyond just erb and gives you a full MVC framework to help organize your code -- if you don't know the benefit of this then keep using PHP, you won't ever outgrow it.

It takes about 3 hours to learn more than enough Ruby to do pretty much anything you would want to do with Rails... so give it a shot!

chaostheory says:

Unless you've done a good amount work using BOTH Rails and PHP - your comments are near worthless, aside from continuing a religious flame war. Even then, different people do the same things differently; so naturally they'll be more efficient with different tools...

This is a waste of time. IMHO you should either be building something or help someone else building something - instead of dissing someone else's work that they're sharing with everyone for free.

sethgodin says:

I thought PHP was some sort of illegal drug...

Nirav Sheth says:

Rails is better for building new web apps from scratch vs. PHP for building upon existing web apps. If you do it right, you can get much better results for Rails based applications than PHP ones. And its done in smaller amounts of code!

 
 
1 of 1 page
 

PHP Lovers: Post Your Blog Posts and Supporting Links Here 

7 reasons I switched back to PHP after 2 years on Rails - O'Reilly Ruby

SUMMARY: I spent two years trying to make Rails do more...1 point

Rails Lovers: Post Your Blog Posts and Supporting Links Here 

Why I Prefer Ruby on Rails vs CakePHP

Last year, I had a goal to learn Ruby on Rails and more...1 point

PHP vs. Ruby on Rails. An evolutionary story of a Web Developer and his tools. - O'Reilly Ruby

A comparison between the #5 language (ranked popul more...0 points

Rails Envy: Ruby on Rails vs. PHP - Ruby on Rails Commercial #6

During the last round of videos, we got quite a fe more...0 points

Slow Down

Don't take this lens too seriously. Of course PHP vs Rails isn't a fair comparison, and I left out many of the reasons why Rails can be a better choice for your project. This lens is just a thought exercise and a way for you to express your opinion and feel better about your platform of choice.

Learn More About PHP 

Is there a better book out there? If so list it below.

Learn More About Rails 

Is there a better book out there? If so list it below.