Facebook is not written in PHP


Yea, I know you're thinking "This guy's nuts! Everyone knows Facebook is PHP!" Sit down, shaddup, and I'll explain...

But let me address this first: The claim that "Facebook is written in PHP" is frequently used to rationalize using the world's worst language. This is, of course, idiotic because appeal to authority is a logical fallacy. To put it in simpler terms: Just because Ozzy Osbourne abused the hell out of drugs and alcohol and wound up rich, famous and alive, obviously doesn't mean it's a good approach to imitate. Get the picture? So quit saying stupid shit like "PHP is fine because XXXX uses it". It makes it obvious you're an idiot.

Ok, back to Facebook's usage, or not, of PHP:

Like any remotely sane company, Facebook doesn't use PHP for its core systems. The actual "core stuff" language used varies by company, but at Facebook, they "use C++ heavily on [their] back-end systems"[1]. In fact, they "use C++ at Facebook all over the place".

While Facebook has things that are ostensibly PHP, it's not the real PHP. The real PHP is such a piece of shit, Facebook had to write their own alternate version of it (HipHop's HPHPc, which converted the "PHP" to C++). Then they had to make another, the HPHPi. And then yet another, the HipHop VM. Facebook does not use real PHP, and that's because true PHP is just simply crap unsuitable for them.

Not only that, but the psuedo-PHP that Facebook does use is being quickly overtaken by Facebook's increasing usage of C++: "...two years ago, maybe 90% of [Facebook] programmers wrote PHP and 10% C++. Now there are roughly as many C++ programmers as PHP programmers." Additionally, Facebook has had growing internal interest in D (note that link is over a year old already), and Facebook's HipHop team is one of the sponsors at this year's D conference.

So ultimately, no; contrary to conventional "wisdom", Facebook is not written in PHP.

[1]: See question #4 here.

27 comments for "Facebook is not written in PHP"

  1. (Guest) Fathan
    2013-11-18 03:12

    Is it true?

  2. (Guest) guest
    2013-11-21 12:54

    You might want to call FB and tell them they are not using PHp They seem to be confused http://www.zdnet.com/blog/facebook/why-facebook-hasnt-ditched-php/9536

  3. 2013-12-19 02:20

    They use what they informally call "PHP", but the point is Facebook's PHP != real PHP. This is one notable element of what that FB worker sums up as "...Facebook's engineers have managed to work around many of its flaws through a combination of patches at all levels of the stack..."

  4. (Guest) guest
    2014-01-26 22:18

    on what basis we can believe this !! We have been reading through several resources that Facebook is built using PHP. I am a PHP developer under impression of Facebook built with PHP. I am intersted in knowing the Clear Picture Behind The Mirror ...

  5. 2014-01-28 02:23

    "on what basis we can believe this !!"

    What I wrote above is filled with a nifty cutting-edge technology called "links".

    "We have been reading through several resources that Facebook is built using PHP."

    Why do people insist on replying to things they obviously didn't read? I'll never understand that. Once again:

    "While Facebook has things that are ostensibly PHP, it's not the real PHP. The real PHP is such a piece of shit, Facebook had to write their own alternate version...Then they had to make another...And then yet another..."

  6. (Guest) guesk
    2014-05-01 02:15

    cuz us readers are lazy

    you'll get more people to believe you if you include specific key quotes from the links, or rather more of them

    such as for support on the fake php thing, you could have a quote from a Facebook employee saying that this is the case, like you did to support that Facebook uses c++

    honestly, i didn't read your links. but i don't really care about the issue, i don't like php and primarily use c++ and java

    i think your article was convincing and well written, and it made me laugh how pissed you are at php. i also liked how you brought in the part about the logical logical fallacy, though keep in mind its an informal fallacy, so it does not guarantee that the result of the action is neither wrong nor right

    8/10 would read again

  7. (Guest) Today
    2014-09-24 14:15

    Hmm, bullshit against PHP again.
    Loock at Phalcon.PHP framework that convert php into C and it runs into the RAM
    http://phalconphp.com/en/

  8. (Guest) guest
    2014-10-13 21:08

    ..........

  9. (Guest) guest
    2014-10-15 02:07

    php is the best pukingina

  10. (Guest) Ian L
    2014-10-19 13:25

    PHP now has an alternate runtime. It's called HHVM. It runs PHP (as well as Hack). Just like JRuby runs (most) Ruby code better/faster/more awesome-ly, HHVM runs (most) PHP code better/faster/more awesome-ly. Just because it took years upon years to get a widely used alternate runtime doesn't mean that that runtime is "no true Scotsman.:

    Also, any larger company will use Service Oriented Architecture and APIs to communicate between application components. Facebook is no exception...and they have developed a stack that optimizes developer productivity and infrastructure costs by using C++/C for components that need the extra speed and don't change much...and Hack/XHP (plenty close to PHP...and I'm sure there's some regular PHP in there) for less computationally intensive tasks where optimizing developer time is more important.

    My bet is that, in terms of features shipped, the Hack/PHP folks ship significantly more code than their C++/C counterparts. And I'm sure that, despite how fast HHVM is, the C++/C counterparts build code that runs faster.

    As full disclosure, I build APIs that run on PHP. My latest project runs well on PHP 5.6...and runs even better on HHVM 3.3, with server-side response times in the 20ms range on simpler, but not trivial, calls. Not bad, huh? Oh, and by using modern programming principles, code is pretty maintainable/testable/modular. Most people who write PHP don't do it this way...that I'll grant...but an increasing percentage are, and that's a good thing, since the language is pretty much ubiquitous (if you have a Mac you have PHP installed, along with python).

  11. (Guest) Ian L
    2014-10-19 13:27

    Also, this blog runs on an outdated version of a PHP CMS. The irony.

  12. 2014-10-24 17:05

    "No true Scotsman" isn't really applicable here as it dodges the main point I'm trying to make:

    Most of the times I've heard people suggest, or specifically request, PHP it's been in cases where none of Facebook's PHP implementations (such as HipHop, ie HHVM) would actually be used. Instead, it's mostly been people who have never even heard of HipHip who are expecting me, or some other programmer, to use *stock* PHP - and often on some fly-by-night shared host (which are mostly just plain old stock LAMP).

    Then, these same people keep trying claim "But it *IS* a good idea! After all, Facebook does it!" Which, of course, is complete bullshit because, as I've said, Facebook does NOT use the same stock PHP that all these idiots are trying to advocate. (Also, these are usually the same people who still believe Facebook is *entirely*, or *mostly*, written in PHP - which still isn't true even if you do count HipHop, or heck, even if you count Hack.)

    Which PHP is the "real" PHP is NOT the issue. The issue is: When someone tries to justify using *stock* PHP because Facebook allegedly uses it, then that someone is an idiot who doesn't know what the hell they're talking about.

    Additionally, and I think this is really the more important part: If a language has to be compared to C/C++ (of all things) in order to look good (or compared to Java for that matter), then something has clearly gone very, very wrong with said language. It's like saying "My horse shit sandwich is awesome because it tastes better than a dog shit sandwich." Yea, well, they both taste like shit.

  13. (Guest) guest
    2014-10-24 17:17

    Thanks @Ian L for pointing out that HHVM is just another implementation of PHP. Writing that HHVM would be an "alternate version" of PHP is just wrong. If the message of this article is intended to be that Facebook doesn't use PHP's reference implementation, it should be referred to that as the reference implementation or as Zend PHP. The language PHP is not the same as the PHP implementation. An "alternate version" of PHP might be Hack (http://hacklang.org/), but HHVM isn't (even though it supports Hack as well as PHP).

    Also, Facebook is not not written in PHP just because *parts* of it are written in other languages or because it uses another PHP implementation.

    And, last but not least, bashing doesn't make you (or anyone else) cool, whether or not it's regarding PHP or anything else.

  14. (Guest) guest
    2014-11-21 21:31

    If PHP was so shit, why would they even bother with a "psuedo-PHP" as you put it? They wouldn't use it all if they didn't like it, and if it was as shit as you say.

    The person who wrote this article is a fucking moron who thinks they're awesome because they're on the "PHP sucks" bandwagon. Well, you're not awesome. You're just a cunt who needs to get off his high horse.

  15. 2014-11-22 01:12

    "If PHP was so shit, why would they even bother with a "psuedo-PHP" as you put it?"

    Why would they have bothered making HipHop and Hack if they were happy with the stock "official" PHP?

    "They wouldn't use it all if they didn't like it, and if it was as shit as you say."

    That's true, and that's why they're AREN'T using it. First they replaced stock PHP with various versions of HipHop, and now they're migrating to Hack. And don't think they won't continue to evolve Hack - as they do, their frontend codebase will continue to resemble PHP even less, and less, and less.

    "You're just a cunt who needs to get off his high horse."

    Not gonna happen. My cunty-self is enjoying the bumpy ride. Yee-haw.

  16. (Guest) The Anti Guest Troll
    2014-12-02 02:00

    Loved reading this thread that spanned 20 months but read as if it was all done today.

    And I close by saying: Profanity is the crutch of an inarticulate mother fucker. :) Yes I'm talking about you Guest troll from November 21, 2014!

  17. (Guest) guest
    2015-01-03 03:54

    Do you think calling a group of people "idiots" is going to actually convince someone you're smarter than they are? Really??

  18. 2015-01-03 11:40

    Do you think convincing someone you're smarter than they are is actually the reason people call a group "idiots"? Really??

    ;)

  19. (Guest) QatQat
    2015-01-07 07:09

    Unfortunately PHP has lead many people believe that they are good programmers simply because they can query a database from a web page. To me it's no different from old classic ASP, just a touch more updated. The lack of real OO feel and the awful procedural flavour that scripts tend to have makes it really not attractive for any enterprise development.

  20. (Guest) guest
    2015-02-05 04:58

    PHP does the job fine for me. I'd rather use a site written by a good PHP programmer than a bad programmer in whatever other language. It's kind of sad that people can get so bothered about something as mundane as what choice of language others use to build a web site. It's boring, frankly.
    I take it everyone should be using D, Abscessa?

  21. 2015-02-13 14:10

    @guest: People just don't pay attention, do they? I never said anything about what language other people should or shouldn't be using. Don't put words in my mouth.

    What I *am* saying: if someone does choose a particular language, the reason should AT LEAST BE VALID. Here's the difference:

    Invalid (ie, broken logic):

    - "Facebook is written in PHP" is an invalid reason to use stock PHP off of php.net because it's factually inaccurate and not even the same implementation anyway.

    - "I happen to like PHP and don't see anything wrong with it" is also invalid - NOT because of the "I like it" part (although that does make me question their sanity, or at least wonder just how masochistic they are), but because plenty of big issues and pitfalls with PHP have been widely identified and discussed. So "don't see anything wrong with it" is just pure unadulterated ignorance. There are things wrong with ANY language. Being blind to that is someone's ignorance, not someone's personal opinion.

    Valid:

    - "I happen to like PHP, and just happen to have dealt with it enough that I've already learned what the issues are and how to avoid them or deal with them" THIS is perfectly valid. But note that most PHP developers do NOT fall into this category. The ones that do? Fine, they can spend their 40+ hours a week "dealing" with it if that's what they want.

  22. (Guest) guest
    2015-07-08 14:46

    @QatQat
    Nonsense. If you make claims like that you clearly haven't looked at the current state of the language. OO support is pretty decent since PHP 5.5 or so. You can write rubbish code in any language, including PHP, but it doesn't mean all code written in PHP must therefore be rubbish.

  23. (Guest) guest
    2015-07-29 14:31

    get real cunt. PHP rocks since 5.5.
    D is short for douchebagz.

  24. 2015-07-31 10:03

    Heh heh, that last post is the best argument I've seen against PHP. "This is your brain. This is your brain on PHP." ;)

  25. (Guest) guest
    2015-10-15 18:40

    The author of this article doesn't even know the difference between language and runtime environment, LOL.
    You can't say "website X is written in HHVM" because HHVM is not a language, but a runtime environment.
    If you had talked about Hack (which by the way is just an extension of the PHP language) then your post would have made slightly more sense.
    By the way PHP 7 (which is the latest version of what the OP in his/her ignorance calls "real PHP") is now in many cases faster than HHVM (e.g. https://ckon.wordpress.com/2015/08/09/wordpress-4-3-benchmark-hhvm-vs-php7/).

  26. 2015-10-15 19:18

    The language/runtime distinction is irrelevant here. Facebook isn't using the official runtime, and they're also moving away from the language too.

    And speed is nothing more than the tip of the iceberg when it comes to PHP's problems.

  27. (Guest) guest
    2016-02-19 06:15

    Php is written in facebook lol

Leave a comment

Captcha