CakePHP vs. Ruby on Rails

By Matt Bowden (BlenderStyle)
Why I chose CakePHP over Ruby on Rails for my websites.
There's no doubt about it, Ruby on Rails is awesome. The guys at 37signals make great software on top of Rails to prove it. Ruby is a very easy language to learn too. So, why did I decide to use CakePHP instead? Well, there's a few reasons.

As a web designer/developer, I'm often faced with the task of rebuilding an existing site. This means I'm usually stuck using their web host, as opposed to one I recommend. That's where Rails can fail. In order for Rails to work, the web host has to support it. When I first delved into Rails, I tried to set it up on my Linux server at home (I didn't want to use the Webrick server), and that's when I got a bit frustrated. It was difficult, and I needed to develop an application like yesterday. My server was already configured for PHP, MySQL, and Apache with mod_rewrite. That's all CakePHP needs to work, and most web hosts meet these requirements. Besides, I'm already really familiar with PHP.

It's also worth mentioning that a lot of the screencasts for rails involves using scripts on the server's console. Most websites I design are on shared web servers, so shell access isn't available. There's ways around using these scripts, but still, it makes these screencasts appear too good to be true. CakePHP is just more realistic for a broader audience. Don't get me wrong, Rails is good, and Ruby is arguably an easier language than PHP, but the code is only half of the battle. We have to take everything into account.

 

Comments 71

CakePHP Team Comments Author Comments
 

Comment

1 Yep

You have a reason...
A lot of clients use own host. And hoster don't like to setup any software ;-)
Even php5... A lot of php4 and may be 1-2 php5 hosts.
So, this one point, why I choose CakePHP - php4.

But, I find normal host wiht python, ruby, php... for my blog <a href="http://www.ouch.kiev.ua">ouch</a> ;-)

So, I hope in near time I study Ruby and could find different between cake & ruby, by myself.
Posted Sep 27, 2006 by Vladislav
 

Comment

2 Scripts

I don't like those little scripts you use in shell. They make code for you. I don't like to modify code which was generated by machine. With cakephp you don't have to generate such code and to make a controller php file and write the class definition in it isn't much work so I think those little scripts are not needed!! And i like CakePHP because you don't have those huge xml configuration files like in symfony! :)
Posted Sep 27, 2006 by Christian Trummer
 

Comment

3 Clarifying

"My server was already configured for PHP, MySQL, and Apache with mod_rewrite. That's all CakePHP needs to work"

You make it sound like Cake needs mod_rewrite to work, this is not true, Cake can work without mod_rewrite.
Posted Sep 30, 2006 by Othman ouahbi
 

Comment

4 Layers

It's also irritating how Rails needs a huge stack.

It's pretty much like...

lighttp
ruby
rubygems
rails
a load balancers and whatnot
version management / whatnot, svn, capistrano

and there are wayy too many options for servers, etc. Mongrel, lighttp, apache, scgi, fastcgi, webbrick... each one has too small a share for it to be efficient in that area.
Posted Oct 2, 2006 by Tom
 

Comment

5 php4 always needed

many framework just sticks with php5 from now on, thank god, phpnut, nate and others to keep cakephp code for php4 and php5.

a real life example: a non-upgradable plesk server, 7.5.4 reloaded on debian, just can't handle php5, so it is sticked with php4.
Posted Oct 3, 2006 by Claudio Poli
 

Comment

6 In defense or RoR

Christian Trummer said:
> I don't like those little scripts you use in shell.
> They make code for you. I don't like to modify code
> which was generated by machine.

Actually, scripts/bake.php in Cake does the same. The code "generated" by RoR's script/generate is only the skeleton.

You don't have to use the generators, you can create the files manually and declare classes by hand. There really is no difference between RoR's generators and Cake's bake script :)

Tom said:
> It's also irritating how Rails needs a huge stack.

> It's pretty much like...

> lighttp
> ruby
> rubygems
> rails
> a load balancers and whatnot
> version management / whatnot, svn, capistrano

Actually, you only need a webserver (lighty or apache can do alone if you control the environment), a database server if you are going to use a database and ruby installed. With Apache and MySQL you can do fine (though you *do* need mod_rewrite).

The rest of the stack is optional. Think that for Cake, you could benefit from running the app in a server cluster and using a load balancer the same you benefit for rails. You don't *need* svn or capistrano to run rails apps, it just eases deployment.

Rubygems and rails aren't needed to run rails, just to generate the app, you can do so in your development box and then upload the completed app. In the same way, you don't need to run the scripts *in the server*.

For example, you don't need an editor with syntax highlighting to program in php, it just speeds development by simplifying the task :)

In the end all you need in the server is ruby, a webserver with rewrite_capabilities, and maybe a database server. After that, it's all optional.
Posted Oct 6, 2006 by Nicolas Sanguinetti
 

Comment

7 sdfgdfg

And i like CakePHP because you don't have those huge xml configuration files like in symfony! :)

symfony is too fat. i like cakephp more than symfony and/or RoR.

installing RoR on a linux is a little more complicated than installing on a Windows. Although I love the principles of RoR, I'd still prefer PHP not because of its quality language, but more of (i dont wanna use this term) prejudicism.
Posted Oct 19, 2006 by warren
 

Comment

8 RoR vs Cake

There is no doubt about the quality of the rails framework+ruby. I discovered RoR and immidiately bought the book, studied the tutorails and screencasts. It was obviously clear this frameworkstructure + mvc and the db abstraction layer were a very powerful combination. The idea of don't repeat yourself was very appealing!.
At that time i was coding php, and starting to make my framework tools. RoR is much more powerfull so i decided to eventually skip to RoR.

But then i read about the CakePhP framework. I tried it and now im addicted to it. Finally im getting to the point where i can do all the interface/interaction experiments with all the data handling already done (im builiding my own (2.0?) cms for use in profession) I have built 3 commercial websites on Cake. One of them is a medium sized funsport travelagency. Im looking forward to the launch cus im pretty curious about the realtime performance on the server. I get the idea Cake's abit slow in data collection sometimes.

When i have the time, ill check out RoR again, the combination with ruby is very powerfull. My understanding of the framework structure has grown since i already knew how to handle php.

Ill stick with php for now but on the long-term, when websites become larger and more complicated, RoR is the way to go i think. The OO language syntax is somewhat more readable than php (when you get more skilled) and you can create offline programs + numerous of other very cool features. Also the documentation on RoR and Ruby are pretty good. Not as abundant as php documentation but quality surpasses quantity in my opinion.
Posted Oct 27, 2006 by Tim van Oostrom
 

Question

9 Dynamic Scaffolding

I'm a newbie to CakePHP. From what I have been so far it looks very promising. The main reason I chose CakePHP over ROR is because of the wide array of open source apps currently running on PHP. It makes it a lot easier when I want to intergate a PHP forum app with my user profile data.

Anyhow, I was wondering if Cake has the ability to generate the model, the controller, and all of the views for you when it comes to CRUD. I know that Cake has the "scaffold" option, but what I want to base level code generation for creating production CRUD. Much like $ ruby script/generate scaffold <name>. Can bake scripts do this for me?
Posted Oct 31, 2006 by Anand
 

Comment

10 Bake scripts can.

Yes, bake scripts can do generate framework controllers, models, and views for you.
Posted Nov 6, 2006 by Walker Hamilton
 

Comment

11 CakePHP vs Ruby On Rails

Here is another article on
<a herf="http://klimb.com/blog/?p=12">
CakePHP vs Ruby On Rails</a>
Posted Nov 25, 2006 by Dmitry Kalashnikov
 

Comment

12 CakePHP vs Ruby On Rails Article

Here is another article on
<a href="http://klimb.com/blog/?p=12">
CakePHP vs Ruby On Rails</a>
Posted Nov 25, 2006 by Dmitry Kalashnikov
 

Comment

13 things are changing

time passes away, and hosting are begining to support Ruby.

so, at least, one of the reasons of this article is "old".
Posted Aug 3, 2007 by vladimir prieto
 

Comment

14 Setting up RoR is no harder than installing PHP MySQL Apache Cake

And i like CakePHP because you don't have those huge xml configuration files like in symfony! :)

symfony is too fat. i like cakephp more than symfony and/or RoR.

installing RoR on a linux is a little more complicated than installing on a Windows. Although I love the principles of RoR, I'd still prefer PHP not because of its quality language, but more of (i dont wanna use this term) prejudicism.


Only as complicated as installing Apache, MySQL, Ruby and mod_rails for Apache.

I was able to setup this environment in 10 minutes.
Posted May 28, 2008 by Matthew Harris