TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: PHP or Ruby?

8 pointsby neel980over 12 years ago
Looking to build a website with social networking elements to connect people. Which is a better choice, PHP or Ruby? Need to consider scalability, performance, ease of development, support, hosting...

23 comments

rb2k_over 12 years ago
Scalability doesn't have anything to do with the programming language but rather with the architecture. The same goes for performance unless you're talking about pure number-crunching. The ease of development depends on your experience with either toolset.<p>I'm sorry if this sounds harsh, but by asking this question you sound like you aren't a programmer but rather somebody that wants to go to rent-a-coder and have somebody build 'the next facebook'.
评论 #4483680 未加载
评论 #4483732 未加载
Lazareover 12 years ago
Short answer: Any language can scale, and any language can perform well. The easiest language to develop and support is the one you know. Hosting is just as simple/easy/cheap with either language. If you already know one of those languages, go with it. If you don't, go with Ruby; it's a vastly better language, with a more mature ecosystem.<p>Longer answer:<p>* Scaling and performance is mostly an issue of architecture, and is heavily dependent on what you're trying to accomplish. You can go a long way just by using varnish/nginx/memcached as appropriate, and serving static assets from a CDN. The actual language is sort of a sideshow, because no language is fast enough; everything needs to be pre-calculate and cached.<p>* If you don't know either language, you'll probably find that Ruby is easier to learn and become productive with, but it's easier/cheaper to find good PHP developers. Kind of a wash. In either case, you will absolutely need to pick and learn a framework as well, which adds more overhead. (No, you aren't going to write a social networking app in PHP without a framework.)<p>* It's easier to get a basic PHP page hosted, but if you're even <i>thinking</i> about scalability and performance, then you need more than Bob's Discount Hosting. Doing PHP hosting right is no easier (or harder) than doing Ruby hosting right.<p>Basically, it doesn't much matter. At the end of the day, <i>most</i> (not all) programmers who have programmed in both detest PHP and love Ruby, and you'll <i>probably</i> find it easier to hire PHP devs.
shaneljaover 12 years ago
I personally prefer PHP, having used both.<p>I'm not saying that Ruby is better or PHP is better, it really depends on your ability with the two, but from what I have found in the past, PHP has been easier to scale and has performed well, it is also more widely hosted, though this is really irrelevant as there are still plenty of ruby hosts.<p>Support for PHP is generally better as it has a larger user-base but generally Google is your friend either way.<p>You should make the decision based on personal preferences, for instance, I find Ruby much more fun to write, but I can't stand debugging it, whereas I have used PHP for so long that now, those stupidly bad error messages are actually a native language to me.
anujkkover 12 years ago
The one you are more comfortable in developing. Choice of framework is more important. If you are good in PHP choose a framework like codeigniter or symfony. If you are good in Ruby choose a framework like Rails.<p>I have developed in all php, ruby, python and my personal favorite is Python/Django or Python/Flask.<p>If you want to use any 3rd party api e.g., Facebook API make sure it has official SDK for language you choose.
评论 #4483712 未加载
eclipse31over 12 years ago
This is a question I've been dealing with myself for some time. I've alot of professional experience with PHP but have done some work in Ruby (on Rails) too. I'm looking to build a decent size site and in the end have opted for PHP for the following reasons:<p>- familiarity with the language - wide support and hosted everywhere - not restricted by Rails 'norms' - easier to get up and running on a live server, even if it's your own virtual box - proven scalability - personally not mad on ActiveRecord (Rails way of interacting with DB). Would rather have greater control over my DB interactions, which I know is possible in Rails but it's very non-standard<p>Ruby IMHO is a far superior language to PHP, but you will have to learn a framework to get it up and running on the web, whether it's Rails, Sinatra or something else. Same with Python. PHP doesn't require a framework, although plenty exist, so it'll be easier to get an initial prototype up and running.
vaidikover 12 years ago
If you are considering PHP, do explore Yii framework. I haven't used Yii myself but I have heard a lot about its goodness as compared to other PHP frameworks.<p>If Ruby, RoR should be the first choice I guess. You may also want to consider Sinatra.
wldlyinaccurateover 12 years ago
Are you going to be writing the majority of the code? If so, try out both languages for a few days each and see which you like better. Spending a week choosing the right tool for the job will save you countless hours in the future.<p>If you're outsourcing the development then you shouldn't be concerned about which language is used. You should be looking for a team of developers who know what they're doing and have experience building systems similar to yours.<p>Performance and scalability shouldn't be factors when choosing a language, either. Good caching and a delivery network like Akamai or CloudFlare will be more than enough for most large websites. I work on several large (100k+ visitors/day) websites that run on PHP - we get by just fine by caching the hell out of everything on multiple levels (web server, traffic manager, Akamai).<p>My advice is to focus on the end product, not the implementation. Don't get caught up in which technologies to use, or you will lose sight of what you want to create.
peterhiover 12 years ago
However if you are looking to recruit coders for the project first you need to find a good (PHP / Ruby) coder and then let them help you with the recruiting. If your skills in either PHP or Ruby are not up to snuff then you are likely to make some serious recruiting mistakes.<p>Also I would recommend that you take a serious look at python. My personal preferences puts java at the bottom of the list and PHP above that but below python and ruby (I'm a ROR developer by the way).
dailygrindover 12 years ago
PHP if you are on a shared hosting environment, otherwise Ruby.
Bolgarover 12 years ago
If you ask such questions, then php
dirkthemanover 12 years ago
Do you already know one of these languages? You know what they say about photography: the best camera is the one you have with you. The same goes for programming: if you already know how to build something in PHP, there's not much sense trying to make the project in Ruby.<p>If you know neither, try both of them for a short while and see which one you like better. It's really a 'what do you like better: apples or oranges' kind of question.
sandGorgonover 12 years ago
If you are concerned with Ruby and scalability, use JRuby on top of Tomcat. It does give you a few pieces of magical scalability, however (and more importantly) it allows you to work with "enterprisey" Java tools/libraries/systems that allow you to reach reasonable levels of scalability quickly.<p>And read this - <a href="http://www.ruby-forum.com/topic/1119702" rel="nofollow">http://www.ruby-forum.com/topic/1119702</a>
jacobwgover 12 years ago
I agree with many of the other comments here (I prefer ruby myself, but agree that the architecture is what determines scalability).<p>On the PHP bit, I've done a fair amount of PHP work, but am trying to avoid it for the following reasons: <a href="http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/" rel="nofollow">http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de...</a>
franklaemmerover 12 years ago
PHP is phantastic. Ruby is rubbish. &#60; just kidding. You can do cool scaleable stuff in both languages (nowadays).<p>Choose the right hosting environment. Maybe a scalable cloud platform? Consider a PaaS like: Heroku, DotCloud, AppFog …<p>Shameless Plug: We are developing a PHP Platform ourselves: <a href="http://fortrabbit.com" rel="nofollow">http://fortrabbit.com</a>
troelsover 12 years ago
None of the points you list have any relevance for making a choice. The two languages are so similar, that it's (imho) entirely a matter of taste which you prefer. If you have experience in either, probably go with that. If you don't, see what your immediate support network prefers and go with that. You're going to need their help when you get stuck.
timurtamerlanover 12 years ago
I'd suggest you consider: 1. Labor costs. Ruby developers may be twice as expensive as PHP ones given the same level of tasks to be solved. 2. Labor availability. Whether it is easier for you to find PHP programmer or Ruby programmer when you need one?<p>For me in Russia answer is definitely PHP, Ruby guys are rare and expensive here :)
manuscreationisover 12 years ago
Both<p>Neither<p>Do some research and find which one works best for the product you envision building. If they both sound like a good fit, go with whatever one you can get help with more easily, since you mention (in the comments) you're not a programmer.
neel980over 12 years ago
Am considering Ruby at the moment. But reminded of Twitter dropping Ruby due to certain reliability issues. Hence having second thoughts. Or am I a little ahead of myself here worrying about something that may never affect me?
评论 #4483714 未加载
评论 #4486009 未加载
评论 #4483670 未加载
mmahemoffover 12 years ago
This question needs a lot more context for any answer to be useful. Who's the developer? What's the long-term plan? What's your own background? What does the app do?<p>I hate to say "It depends", but sometimes it really does.
phoenixwizardover 12 years ago
I would suggest Rails if you want ruby and definitely consider Laravel as a php framework. I am quiet loving the framework, though am bootstrapping one of my web apps on laravel and majority of my works are in Rails ...
borplkover 12 years ago
These threads really will get you nowhere. There are countless discussions like this all over the internet and in every one of them you'll find people stating one or the other choice. You need to try it for yourself.
neel980over 12 years ago
Thanks for the responses folks.
gitarrover 12 years ago
Python. (YouTube, Reddit, ...)<p>Second choice Ruby without a second of doubt.