While RoR is getting better in this respect, PHP is vastly better documented (both officially and all throughout the web) and the community is (at least, for now) superior to RoR. This is something that simply requires more time for RoR, as PHP has had quite a few years head start to get to where it is.
In practice, it honestly boils down to what you're doing and what's easier for you (and your team). If you want to test the waters, follow a few tutorials for each that you're unfamiliar with, and see what suits you better.
If you're using a shared server, you also have to make sure that your host supports RoR (most hosts don't). So that could be an extra expense to consider.
Me personally: I'm a php person. I prefer PHP + CodeIgniter, and I'm all happy :) RoR is fine and dandy, imo, but wasn't worth 9 years of PHP experience when PHP works amazingly well for everything I've ever asked of it.
If you want to learn a lot of good practices and maintain and extend your codebase in the future, RoR is fantastic - but may be a steep learning curve due to all the new concepts and levels of abstraction involved, and is somewhat harder to deploy, and probably somewhat more expensive to host.
If you want to "hack something together quickly" to deploy cheaply on any of a wide range of hosting providers, PHP provides a famously productive way to make a mess^H^H^H^H simple web app.
From knowing nothing to building a simple web app, PHP is faster.
If you already know RoR and have your dev machine and deployment environment all set up, then it's not hard to get a Rails app working. Rails has a significant advantage with the use of gems (and bundler, etc.) for easily adding complex features.
I still use PHP for my home projects most of the time because I haven't bothered to set up Rails on my VPS, so the effort it would take to do so just isn't worth it compared to how easily I can drop a PHP app in place. (I am using a framework in PHP too.)
But then, the author was talking about PaaS not setting up Ruby on a VPS. So in that case it's probably just about how comfortable the developer is with each language. I'm a bit more comfortable with PHP because I don't like debugging Ruby GEMs that use instance_eval black magic for DSLs and/or have to be inserted as Rack middleware. Not unless the project is large enough to make Ruby gems worth it.
(Eg. if I want good unit and integration testing. For home projects I rarely do integration testing. E.g. #2 was rack middle ware for REST API.)
I ask because there are so many open source projects based on PHP code, but from what I've read RoR is faster and easier to work with. I'd like to get opinions on the matter to reference for future decisions in startup development
Build a prototype with a few features in both and see which feels natural to you. I like to bang out small, silly projects in PHP with CodeIgniter or FUEL because I can move fast with those. But I find Ruby and RoR more methodological and RoR will handle more intricate stuff for me that the PHP frameworks won’t and will use that combo for bigger apps.
It's about the developer, not the language. Just write good code and the language at the beginning won't really make a difference. If you like rails but you are more comfortable with PHP, maybe you could try CakePHP or Codeigniter. Even Python/Django could be an option you should consider.
Also for RoR you could use Heroku that makes deployment a breeze, but definitely when it comes to resources Ruby is way more expensive than PHP.
You can just as easily say RoR is slower (than, say, Symfony 2.0 on PHP with an opcode cache) and harder to work with (from a system administration perspective).
Take a look down the top 100 website list, and of those sites that are web applications, more of them will be built on PHP than not. I don't think there's even a Ruby application among the top 100 sites except parts of Twitter, but I could be forgetting something.
- Facebook
- Yahoo! (Answers, Bookmarks, Delicious, etc)
- Wikipedia
- WordPress (.com application is #19, another 14 million active installs of the free software)
- Flickr
It may not be cool right now, but it's certainly practical.
The link you yourself cite shows a fourfold speed advantage for procedural PHP over ROR. Not mentioned is the large memory footprint of a Rails process compared to a procedural PHP page. It's the usual phenomenon of trading off development time and complexity for performance. I'm sure if you wrote a web app in C, it would run even faster.
Rasmus's point in the article is that as soon as you move away from simple apps under light load into real applications, it is no longer enough just to rely on Rails magic. You find yourself needing to understand the innards of what is a very complex environment, and dealing with an idiosyncratic development community that considers monkey-patching a neat programming techinique, and likes to publish its documentation in video format.
He doesn't seem to me to be saying 'don't use Rails'. He's just pointing out you should be fully aware of what you're getting into. Caveat scriptor.
RoR is an architecture. Kind of ironic because I claim that Ruby, as a language, has better support for scaling in the networking/dist.systems view than PHP. Yet, I would like to claim that PHP scales better than RoR in the web app domain. Though, it takes deep knowledge of RoR internals to make a correct judgement; which, very few have.
It is more advice from others + some learning desire as well. These same devs that know PHP very well also gave me the advice about RoR, PHP not scaling well and RoR being better equipped for the future, less bottlenecks, etc.
The last item is complete fluff, PHP will not go away.
I guess the simple things I do in PHP (MySQL querying, some string manipulation, etc) should not be a bottleneck.
When asked I could not name large scaled sites running PHP, but I could name at least 10 that were using RoR.....
I've run server ops (and do development) for significantly loaded RoR and PHP applications (and still do), and I can say that there is more quality information available for RoR than there is PHP for setting up high scale and stable setups.
When setting up a RoR stack, all the information I needed was available, the infrastructure was pretty stable and was easy to debug problems. PHP on the other hand, had close to no information on dealing with high load. The optcache libraries are poorly documented, nobody is really talking about it, and running anything but Apache (for performance, of course) under fcgi was horrifically problematic.
In the end we had to write our own monitoring tools to deal with all the oddities we discovered with the standard fcgi spawner (there were many), and when trying to mitigate memory leaks we discover that there are 'many known leaks in the PHP stdlib, but that's OK because everyone runs short-lived processes and restarts them regularly so we don't need to fix them'. My idea of a robust (fcgi) server would be that it doesn't require constant restarts, but that's just me.
RoR is only one framework in the vast number of Ruby libraries. I have worked in both technologies and there are more well designed, useful and current libraries and tools surrounding Ruby than there are PHP.
Quite honestly I'm sick of people apologising for it and pointing to the 'big players in web' as proof that PHP is OK. In my opinion it really needs to go away. In the years I worked with it, it taught me nothing but bad habits. I'm not the only one.
EDIT: Two Ruby libraries I used recently that were very high quality were Nokogiri (HTML/XML parsing) and Typhoeus (HTTP library wrapping libcurl). I don't recall ever seeing anything like those in PHP that had such intuitive APIs. Can anyone provide any counterpoints of better libraries in PHP that don't exist in Ruby? P.S. Wordpress is not an answer.
I'm most surprised that PHP seems to be around an order of magnitude faster than Ruby on Rails, I knew it was faster, but didn't think it would be that much.
Use whatever will get you to a minimum viable product fastest. How you build the application should have little impact on your business. If you can build the PHP app 5 times faster, and you need to execute quickly (say, short runway upcoming?), using RoR (and the 5x longer dev cycle) would be a poor decision.
Don't get obsessed about your code. Get obsessed about your product. And the best way to do that is to build a throwaway, quickly, so you can talk to customers with it.
You don't think Ruby on Rails requires the overhead of a server???
There are perfectly good and very sophisticated MVC frameworks available for PHP, such as CakePHP (one of the closer to Rails, even down to the command-line "baking" of models, controllers, etc.).
There are meaningful differences to development using both languages, but criticizing PHP because it was popularized independently of any specific framework is not one of them. Especially since there are plenty of situations (think dumb but scalable web services) in which the last thing you want to do is invoke the overhead of a framework in any language.
Funny, but not necessarily true. With PHP, I do as you say and spend, if I know the language, 1 hour max setting up a CRUD list/view/admin.
With Ruby, I have to spend, at least 3 months learning the concepts behind the Rails framework and what the article OP mentions just to get to that 20 to 30 minute mark.
If anything it's all meaningless, and what everyone should understand is that while the closer you are to the web server itself (CGI+PHP, Node.js, Classic ASP), you can quickly create any type of code, at the loss of organization and order.
In frameworks (criticism of Rails can also be attributed to Wordpress IMO) you have a much larger ramp up time learning the concepts and conventions, and once familiar, are able to LEVERAGE those patterns.
But don't bother me with PHP vs Ruby. I run SSI on nginx. It's not even in the same league as those two. BUT it's even easier to spin a basic 5 page website. All tools have their specialties.
Conversely, PHP has one several advantages over Rails. Most notably, immediacy. Deployment via SCP is very satisfying.
Though not as satisfying as using source control and having a one command "deploy" that's just as quick as SCPing a bunch of files.. I can deploy - to production - local builds of my Ruby projects in seconds.
There are no significant advantages to using PHP or disadvantages to using Ruby or Rails presented in that blog post, even though it tries to make it seem that way. (And on the library complaint, the Ruby libraries that came along for things like S3 and EC2 are better than the official ones by a long shot.)
Despite that, different strokes for different folks. Use what works for you and all that!
In practice, it honestly boils down to what you're doing and what's easier for you (and your team). If you want to test the waters, follow a few tutorials for each that you're unfamiliar with, and see what suits you better.
If you're using a shared server, you also have to make sure that your host supports RoR (most hosts don't). So that could be an extra expense to consider.
Me personally: I'm a php person. I prefer PHP + CodeIgniter, and I'm all happy :) RoR is fine and dandy, imo, but wasn't worth 9 years of PHP experience when PHP works amazingly well for everything I've ever asked of it.
reply