PHP vs Node.js Smackdown: Right of Reply

By Bruno Skvorc , James Hibbard
We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now

The gloves are off: an arm wrestle of the editors

In SitePoint's recent PHP vs Node.js Smackdown, Craig Buckler pitted these development disciplines against each other over a series of ten challenges, to determine which is the overall winner.

As Craig notes in the article, these comparisons are always somewhat controversial. As a fun followup, we asked Bruno Škvorc (SitePoint's PHP editor) and James Hibbard (one of SitePoint's JavaScript editors) to provide a commentary on each of the rounds.

Here's their blow-by-blow assessment …

Round 1: Getting Started

Round 1's challenge was to see how quickly you can build a “Hello World” web page in each language. This included the time taken to set up a server environment.

In Craig's estimation, PHP won the round, partly because it's "conceptually simpler" and "less daunting to new developers".


PHP wins in "getting started" purely because more hosts have made it so easy to get started. It's a matter of adoption rather than anything else. If more hosts bypassed the need to use the command line with Node and went straight to file uploads and a simple "reload app" button in a control panel, they would be equal. The actual syntax of getting something to display on screen, however, is much simpler in PHP — especially to those new to programming.


When developing locally, I don't see a huge difference between the two. To run a PHP script in your browser, you need to have some kind of server stack installed; to run a Node script, you need to have installed Node, and preferably a web framework such as express. However, as Craig says, PHP is conceptually simpler. Node's barrier to entry is higher. No debate there.

Round 2: Help and Support

Round 2 looked at how easy it is to get help and support with each language. PHP wins this round, mainly because of its longevity.


Bruno kept silent on this one.


I agree with this. Node.js is a younger technology, so currently, there is less help available. This will, however, become less and less of a consideration as Node matures.

Round 3: Language Syntax

Round 3 compared how easy it is to understand and use the syntax of PHP and JavaScript. Craig awarded this round to JavaScript.


I strongly disagree on this point. While PHP does have its quirks, many of them have been corrected in recent times and many oddities will be removed in the newest release. On the other hand, there's this and this in the JS world.

Regarding bullet 3 (that your brain doesn’t need to switch modes because you can use JS on the client and server), I disagree. The server environment is completely different from the client one, and a switching of brain modes is required. There's also new syntax that you can't use in the browser, and vice versa, so it's kind of like switching languages.

Bullet 4 (that understanding JS makes you want to use it more) is also something I disagree with. Having worked with both JS and PHP for years, the more I work with JS, the less I like it — though that's purely personal preference.


I love JavaScript. I know it has its quirks, and I know it has some gotchas, but ECMAScript 2015 will straighten a lot of this out, as well as bringing some exciting new features to the language. JavaScript is both powerful and flexible, and can accommodate many different styles of programming. In contrast to PHP, I enjoy writing JavaScript. Node deserved this one.

Round 4: Development Tools

Round 4 considered the tools available to each technology, with Node winning by a nose thanks to npm.


While Composer was originally inspired by npm, it's now leaps and bounds better than it and won't break your system if you have to install two versions of the same library, unlike npm. Also unlike npm, Composer can install recursive dependencies, something npm simply cannot do — yet something that is absolutely essential, and should be the very first thought in the head of someone setting out to build a package manager.

npm also has downright awful error messages that are what I like to call "core-developer friendly" — in that only those who wrote them can understand them. Finally, npm doesn't play well with Vagrant, and effectively hinders you in getting started properly — not to mention that they don't pay attention to their users' desires. Here is a bug that's been open for years, making it basically unusable on Windows — hardly a trivial user base. PHP has its share of stupid bugs too, but those don't alienate an entire OS for years.

True, Composer isn't bundled with PHP, but I don't think it should be. Such favor shouldn't be given to a package manager which is, literally, a separate app. If someone, some day, actually makes a good package manager for Node, it'll be bureaucratic hell to switch it out for the current one, let alone get people to transition. Besides, installing it is literally one line in a terminal, or downloading an installer.

The statement that Composer has had less of an impact is plain wrong. Composer has influenced all of the new PHP devs coming on board the PHP train since it was developed, and most of the good ones who had to add it into their current workflow. Just because there were a lot of PHP users before Composer existed, doesn't mean its impact is smaller. Ever since it was made, it has had a tremendous impact. Absolutist statements like "has made less of an impact within the community" shouldn't be made without a factual backing.

I can't argue with the fact that most PHP devs will install Node at one point, that's true. Sadly, a lot of the good tools are being developed Node-first, but I remain hopeful for a Node-free development environment due to projects like BowerPHP.


I'm glad this one went to Node.

I love npm. It's easy to install, easy to use, and there are thousands of packages available for almost any need. I also like the fact that npm lets you choose between the global and local installation of packages (in contrast to languages such as Ruby, where it's standard for your gems to be installed alongside your Ruby version). The tooling is also fantastic. Tools such as Bower and Grunt have a regular place in my workflow, and have increased my productivity many times over.

It's also worth mentioning that npm v3 is out in beta. This addresses many of the points that Bruno raises, such as the nested node_modules approach bug.

Quote of the entire smackdown:

PHP developers will probably want/need to install Node.js at some point. The reverse isn’t true.

Round 5: Environments

Round 5 touched on where the technologies can be used and deployed, and which platforms and ecosystems are supported. Craig wasn't explicit about his call on this one, but it looks like a wet sail for Node.


Craig said he would compare PHP's and Node's web strengths (general web development challenge) and then says JS is everywhere. Firstly, we're comparing Node.js, not JS itself. Secondly, we're comparing the languages and environments where they can run. Saying a monkey is better than a fish because the fish has failed to climb the tree is just silly. But both the monkey and the fish can swim, so let's compare how well they do that.

In a web development environment, PHP wins hands down. There are tools for desktop development in PHP — and yes, true, you probably won't use them. But you definitely will use the command line aspect of PHP.


Again, I agree with Craig. Several of the features that are making Node.js so popular (speed, scalability, affinity with JSON, low resource usage) also make it well-suited for many other kinds of applications, for example powering IoT devices. I mean, who doesn't love robots?

Node has also given rise to projects such as NW.js (an app runtime based on Chromium and Node.js) which allows you to write native apps in HTML and JavaScript. Exciting times!

Round 6: Integration

Round 6 looked at integration with databases and drivers, and PHP wins mainly because of its age.


Integration is a draw. PHP has an age advantage in this, giving it more options, but this also means it suffers from some severely outdated integrations like the mysql extension — which we've only managed to get rid of in PHP7, but which has been unusable for years.


Not sure I agree with this. The whole round seems fuzzily worded, and I would have hoped for an example of "older, less-popular technologies". This would also be a good opportunity to underline one of Node's big pluses — that it speaks JSON. JSON is probably the most important data exchange format on the web, and is also the lingua franca for interacting with many of the latest NoSQL databases. JSON is ideally suited for consumption by a JavaScript program, meaning that when you're working with Node, data can flow neatly between layers without the need for reformatting. You can have one syntax from browser to server to database.

Round 7: Hosting and Deployment

Round 7 looked at how easy it is to deploy new apps to a live web server, and in Craig's view, PHP is the clear winner on this count.


Again, Bruno keeps quiet, having nothing to add.


This is one area where Node has got a lot of catching up to do. Every budget web hosting company offers a PHP packet with MySQL thrown in. To see some kind of output, all you've got to do is create a file with a .php extension, shove some valid statements between <? and ?>, upload the file and point your browser at it. The same cannot be said for Node. There are, of course, many options for Node hosting, but they invariably require more set up and command line access, which is potentially off-putting for beginners. PHP wins this round hands down, no question.

Round 8: Performance

Round 8 focused on speed; and, although this can often come down to the experience and care taken by the development team, Craig noted the advantages of Node on a number of fronts.


Misconceptions abound. First, there is this post which renders all performance discussions moot. Any and all performance gains/losses depend exclusively on the experience of the devs and the type of app. But even if that post isn't convincing you that performance discussions are stupid out of context, here are some of my own arguments:

  • PHP is getting a multi-threaded built-in server. This would make it possible to bypass an external server completely, but not recommended (yet). There are also super fast servers like Nginx which make the whole process of launching PHP and delegating requests to it unnoticeable.
  • Projects like HHVM and Appserver add powerful async and multithreading aspects to PHP, and PHP7 itself is getting some powerful upgrades in that department, too.
  • PHP's single-request app lifetime is the biggest ankle-weight, yes, if you're looking for raw speed; but this, too, can be easily circumvented, not only with Memcached and similar solutions as Craig states, but with methods like Ajax. By the way — server-side JS apps are single-request by default, too. What's more — this single-request lifetime is also an advantage, in that it rebuilds the app every time it's used, thereby avoiding memory problems, cleaning up garbage, and staying lean and clean. When was the last time you used a stable, long-running, memory-leak-free JavaScript application either on the back end or the front end?

Performance discussions are, and always will be, a draw. (Unless you're dealing with Java — then Java always loses! ;) )


Node is touted as the runtime of choice for high-performance, low latency applications, and has already found its way into the code stacks of several Fortune 500 companies. Thanks to its non-blocking I/O mechanism and Google Chrome V8 engine technology, it has become synonymous with the words "fast" and "scalable". There are numerous stories online about how Node brought serious performance gains to companies and lead to greater developer productivity. I'm happy to see this one go to Node, but understand that it's a contentious point.

Round 9: Programmer Passion

Round 9 looked at Craig's perception of how much passion developers are currently showing for PHP and Node, and in his estimation, Node wins hands down.


You are definitely looking in the wrong places, Craig. The PHP community is incredibly passionate and very active. There are over 20 big conferences per year, and some amazing topics get discussed. The treading of water has finished with the advent of HHVM and PHP7.

Additionally, I would say that it's curious that Node's developers still haven't learned how version numbers work (version v0.12.5 at the time of writing), even after 6 years in development. That kind of immaturity and desperate "playing it safe" (whoops, you used something that's unstable, your fault it broke your company lol), coupled with the critical but ignored ancient bugs that alienate userbases of entire operating systems, is something that will turn any serious developer away from a programming language's ecosystem.

I dislike Node. My dislike is based on negative experiences mainly revolving around npm. That might change in the future, but for now, I'm filled with dread and despair every time I have to use Node in any capacity. We all have our preferences, but it's important to remain objective and pick the right tool for the job. But it's also important to admit that sometimes picking the right tool entails picking the wrong one first because you just don't know yet. So don't listen to Craig. Don't listen to Jim. Don't listen to me. Try it out — see what works, find out what feels good and use that. Ultimately, the environment that makes you feel productive and awesome is the best one, not the one that gives you a millisecond shorter loading times.


Node is hot. There is a whole lot of innovation going on right now in Nodeland. Whilst passion is subjective, I'm glad Node won this round.

Round 10: The Future

Round 10 looked at the future of both languages, and Craig declared this one a draw, as both languages look to have a strong future at this stage.


Bruno had to rush off to write some more PHP and edit incredible PHP articles for SitePoint.


James was itching to get back to his beloved JavaScript channel, too, but offered these parting words:

A draw was a fair result for this round. Node is the rising star, but it's going to take something massive to unseat PHP.

To wrap up, if your only tool is a hammer, then every problem looks like a nail. Node isn't the perfect fit for every scenario, and indeed there are many times when it makes sense not to use it. However, what Node does well, it does very well. It's up to you to make an informed choice and choose the best tool for the job.

So, now that Bruno and James have had their say, what do you have to say?

We teamed up with SiteGround
To bring you the latest from the web and tried-and-true hosting, recommended for designers and developers. SitePoint Readers Get Up To 65% OFF Now
  • This is a great comparison. Thanks for James and Bruno.

  • ElDerecho

    The one area PHP really has an edge is in SQL database drivers. PDO makes working with different databases much simpler.

    • Yoni L.

      You’re right, but in fact as soon as node will have better drivers, someone will write some kind of PDO tool for node, we just need to wait…

  • Avi Block

    The fact you can upload a stupid .php file with hello world and get it work, maybe a win for php, but its a completely useless metric.

    In 2015, no professional writes code that way. We use local environments, composer, object oriented programming, frameworks, testing, version control, build scripts, continuous integration and deployment.

    So when it comes to reality, there’s no difference here. Perhaps a small win to node since most of tooling you’ll need is with node, anyway.

    • WooDzu

      > So when it comes to reality, there’s no difference here. Perhaps a small
      win to node since most of tooling you’ll need is with node, anyway.

      What if I need a Content Management System that is stable and easy to extend once deployed, and I need it now. Where is node.js at?

      • Avi Block

        This has nothing to do with node vs php, unless you’re writing the CMS yourself.

        • WooDzu

          Well I think it does matter a lot. One doesn’t code for the sake of coding, it’s about getting the job done. When it comes to web portals 80% of internet websites can’t be wrong.

          • Avi Block

            That has nothing to do with this particular point. That just shows that PHP is more popular in general.

          • WooDzu

            What I was trying to say is that when one needs a web portal driven by content, PHP wins in this particular area. There is nothing on node.js side to compete to WordPress and Joomla. Although this might change in the next 2-3 years currently the choice is simple PHP.

            The choice is driven by the need, not the other way around. Probably that’s why I’d chose PHP to drive content applications and node.js for data-driven apps.

          • Avi Block

            That’s great but it still has nothing to do the point Craig was making about ease of getting starting.

          • Craig Buckler

            Absolutely. You have to start somewhere. How many first-time programmers do you know who use environments, composer, object oriented programming, frameworks,
            testing, version control, build scripts, continuous integration and

          • Avi Block

            You’re right…but since when is low barrier of entry a point for anything. Isn’t that how PHP got itself into the mess that its in?

            The general quality of node modules is generally higher for this reason.

          • Craig Buckler

            I still think PHP is conceptually simpler to grasp. You can write messy code but you can in any language. Those starting development will have an easier route.

            I suspect few novices start with Node.js.

          • Avi Block

            I’m not disagreeing with you there. For sure its easier. That doesn’t make it better. If you’re including this as a reason for directing a novice which technology to choose, then it’s misleading as real code is not written this way.

          • Craig Buckler

            OK, so you’ll soon progress from that example but PHP allows you to learn at your own pace. You can start with simple functions, move to objects and create/use frameworks.

            Node.js throws you in at the deep end. You won’t get far without a solid grasp of closures and prototypal inheritance.

            That doesn’t make PHP better overall but it certainly wins the “getting started” round.

          • Avi Block

            Still not disagreeing with about that. I’m only disagreeing with including this as a metric for comparison. I think it’s as irrelevant as you think PHP is for writing desktop apps.

          • Avi Block

            I do hear the point about progressing slowly. On the other hand, I have a coworker who’s been working with PHP for almost 10 year and still hasn’t “progressed” to writing professional code.

            It’s very easy to get stuck in “upload hello world via FTP” mentality.

          • Craig Buckler

            Ha! In some ways, that’s another win for PHP. It allows dabblers to write some code. It may be awful, but it works.

            I doubt that same developer would get very far with Node.js…

          • Avi Block

            In other ways its a loss. With PHP, if you want to be a professional developer, its not as obvious that you have to invest some time and learn. You can easily stay where you are. My coworker is part of a team which does use all the latest and greatest, and basically does what he is told to do. Unless he puts in the necessary investment, he will basically be a grunt worker for the rest of his life.

            With node, on the other hand, you are forced from the start to learn advanced concepts like closures, prototypical inheritance and parts of functional programming. You are also forced to quickly learn how to architect your program, because there is little handholding. You will also learn quickly about how to write this that do one thing, and one thing well.

          • Craig Buckler

            Hmm, OK, I see your point but not everyone can or will reach Ninja level. There are those who are happy to mangle a WordPress theme and hack code together with no regard to structure or maintenance. That’s fine – and it means you get the more interesting jobs.

          • Yoni L.

            To my mind, you’re both right, i’m in a team who reject massively object
            orinted method (we’re in PHP), and think javascript is outdated by ten
            years lol. I came in one year ago and do the refactoring job. I learned PHP as an autodidacte
            procedural ugly coder, then i learned java and .NET and came after to
            professionnal PHP with design pattern test composer…. PHP is really
            easy to begin and you can not begin node.js without understanding OO so
            without basics conceptual knowledge. so PHP lose the professional
            comparison of beginner quality of code because of it’s simplicity to
            use, WT*F* it’s a non ending story!!

          • Craig Buckler

            Fair enough but I think PHP has gained much of it’s success by being easy to pick-up yet powerful enough to keep professional developers happy.

    • James Hibbard

      > The fact you can upload a stupid .php file with hello world and get it work, maybe a win for php, but its a completely useless metric.

      Not really. What about sites which are mainly static, but need one or two dynamic components (such as a contact form)? In such a case you could write a script in your editor of choice, upload it to your webserver and bingo.

      • Avi Block

        Or use wordpress. Or wufoo. Or something else that doesn’t require programming knowledge.

        • James Hibbard

          Wat? I wouldn’t use WP just to add a contact form to a site.

          • Avi Block

            Create the site in wordpress, and add a contact form.

            And we all know in reality, it doesn’t just stop at the contact form. Its this dynamic feature then that. Before you know, the client is requesting facebook. If you’ve started at “upload .php file with hello world”, you will wind up going nowhere. You will have to rethink the architecture and write real code.

            So much for this.

        • nicholasvalbusa

          LOL wordpress.

          • Avi Block

            What’s so funny?

          • James Hibbard

            Creating a site in WP for the sake of adding a contact form.
            Wordpress is designed to be a blog, so you are consistently hacking it to perform otherwise.

          • Avi Block

            And everything else the client will ask for after the contact form.

  • Thomas Punt

    As soon as I had seen that the other NodeJS vs PHP article was written by Craig, I somehow knew NodeJS would win…

    I feel that this article was a lot fairer and a more interesting read because it looked at the perspectives from people who were biased to their technology, rather than just having the viewpoint of someone who claims to be on the fence (which is rarely the case, as we saw).

    • Craig Buckler

      Really? I’ve written many of PHP (and WordPress) articles for SitePoint! I’ve written many JavaScript articles too (although relatively few Node.js ones). I love both but, at this time, I’m edging toward Node.js for web applications but PHP for simple or CMS-based websites.

      • Yoni L.

        +1 Especially on web application with massive ajax use, i’m PHP developper and Node.js is really better in asynchrone environments because of the non blocking event based method.

      • Patrick Catanzariti

        Craig, I totally agree. PHP still works best for CMS driven content focused websites that don’t require a tonne of user interactions, AJAX manipulations and such. I thought your previous article was definitely nice and balanced. I thought it was actually perfect to have both articles, as all three perspectives were shown really nicely :D

  • WooDzu

    Great read, well done folks! As a follow up article I’d love to read a comparison in different use cases. A few examples: analytics app, blog, e-commerce, vod, brochure website.
    Comparing node to php is like hgv vs sport car.

  • Yoni L.

    It’s so difficult, i like both :(, Thx for James and Bruno

  • The focus of this series seems to be on starting a project from scratch. But there are a lot of projects (my projects, at least), where there is an existing body of material that is being presented in HTML. I can’t even understand Node.js, let alone imagine converting a multi-thousand-page existing HTML site to it. With PHP, after the initial munging to get the existing code base in some semblance of order, I can incrementally augment the site with PHP. I don’t have to eat the elephant all in one bite.

  • Chris de Kok

    Something is missing in this and that is tooling there are not proper IDE’s for javascript unless you start using TypeScript.
    It’s a must for large codebases that you did not write yourself.

    • Craig Buckler

      You can’t get proper IDEs? That’ll be news to Aptana, Komodo, WebStorrm, VisualStudio, Atom, Brackets and SublimeText!

      • Chris de Kok

        You can’t do typehinting on js so it can never have the same functionality as stricter languages.

        • Craig Buckler

          JavaScript isn’t strongly typed (nor is PHP) but that flexibility can be an advantage. But that’s not really an issue about IDEs, though.

  • +1 for Bruno . So difficult to win this game . But Php has some advantages over node, reason may be maturity. Node is younger, soon It will be share the rank with Php.

  • Kevin Nagurski

    I’m a long time PHP developer and like a LOT of PHP developers, I’m passionate about writing really robust applications that are performant and stable. That said, a few years back I had a few months to completely relearn JS and now love it. I don’t know of any other language that is quite so flexible and malleable.

    But as Bruno rightfully points out this isn’t a comparison between PHP and JS, it’s between PHP and Node. I’ve dabbled in Node a few times and really appreciate it’s architecture, but there is something nice about the buildup and teardown that PHP does for each request VS the long-running process of Node. Is it as resource friendly? Nope, but it is much more fault tolerant. Write shitty code in PHP and what you get is what you get. Write shitty code in Node and the performance can degrade until you need to restart the app.

    I also have to agree with Bruno about Composer. It’s completely changed how I work and it’s a joy to use. Heck, even if you don’t ever include a library with it, it can act as your autoloader and make your code leaner and faster with its classmaps.

    But the point about PHP devs using NPM is also valid. I use Gulp and Bower on most projects.

    In the end I would call it a draw too. Both approaches let you write terrible code and run it easily. Both also let you write awesome code.

  • Patrick Catanzariti

    Loving the discussion on this one guys! I do believe both have their pros and cons but each work best for different situations. I find using both PHP and Node works for me. I can see Node becoming more and more prevalent when more hosting services provide solid and simple hosting for it and when a strong CMS powered by Node takes hold (though I wouldn’t say this should be a WordPress clone or anything like that, it should be structured to take advantage of Node’s unique strengths, not every site needs to run on Node either).

  • why is everyone ignoring that you can have the non-blocking joys on php as well?

    • Craig Buckler

      Perhaps because it’s not something which is often used by PHP developers?

      • that doesn’t mean it doesn’t exist – and frankly when comparing, and having it a part of the comparison, then it belongs into the comparison.

        • Craig Buckler

          Does something exist if no one uses it?!

          There are ways to implement non-blocking PHP but you either need a framework or have to delve into socket development. It’s not simple and you may struggle with certain interactions such as database queries.

          In Node.js, you can’t avoid it. Even the simplest command-line app uses non-blocking I/O.

          • are you for real, or just trolling, I honestly can’t tell.

            You can’t deny somethings existance that based on your own estimate no one is using it – especially not if theres several projects utilizing this technology. And if you give JS the advantage by using features from the Node.JS runtime platform, then you have to allow PHP in the comparison, to use features from frameworks that are build for this too.

            Are non-blocking frameworks in PHP as much used or as far developed as node.js stuff? no they are not, but that doesn’t mean they don’t exist, and that means in a comparison where this noted as a feature of node, there should be a mention of whats going on with PHP in this field too.

            Either that, or accept that people will call you out for being biased.

          • Craig Buckler

            I presume you’re using non-blocking PHP? That’s great. But given your original comment, it seems you’re in a minority.

            Most languages offer some sort of non-blocking technology but, unlike Node, it’s rarely required or practical for anything other than real-time apps. That alone doesn’t make Node “better”, but it was one of several reasons why it can be faster than other technologies.

            As for being biased – we all are. Our experiences and choices make us biased. Besides that, it was an opinion piece. My opinion. My biases. You won’t agree with everything and you shouldn’t.

  • Igor Escobar

    This hate about Javascript it is so 90’s.

    • Craig Buckler

      Eh? JavaScript was invented in the 1990s but that makes it one of the youngest mainstream languages.

  • Nice job, awesome

  • Decebal Dobrica

    Love this talk. It shows a lot for what both stand for, although I would say there is not enough people standing by PHP even though they use it.
    I think that the comparison should have included Colaboration (between developers, there are some big projects that came short just because of this) and System Automation (as in threads or routines)

  • sudeep

    PHP is good but Node is Better & champ bcoz its people language developer have made this language very Rich ex – NPM

  • Shane Lee Spritefire Robinson

    In Round 3 Bruno points states that JavaScript syntax is hard to understand and cites a link to back up his point. The link he uses is satire, making his point moot.

  • How about a fair testing: nginx/php vs node/js (clustered) test with a real page with lots of db connections and big images. Node is a server but php is a markup lang.

  • Ibrahim Samad

    That was a very educative comparison. Kudos to both Bruno and James.

  • Jason Taylor

    What you all failed to take into account is that from a pure programming perspective, javascript sucks. PHP isn’t that wonderful, but it is not so ugly and un-intuitive. The kiss of death to server-side javascript is revealed above when it says that you have to switch brains since server-side javscript is much different from client-side javascript. If javascript is this platform- or context- dependent, it defeats the whole point of this horrific language.

  • Doron Nachshon

    Regarding Bruno’s comment in round 3 : “..On the other hand, there’s this and this in the JS world.”

    The “es2015-nightmarefile” link you provided is hilarious, so I’m pretty sure it’s a satire.
    That’s what happens when you google “omg php so gud node.js so bad amirite??” :D