Peter Wayner wrote on InfoWorld an article titled “PHP vs. Node.js: An epic battle for developer mind share“, sharing developers opinions on who’s better PHP vs NodeJs ? First question that come to our mind is why comparing PHP and not any other programming language, most probably because they both have the same purpose or target the same developers if we can say.
Comparing PHP to NodeJs is like comparing Pizza to a Hamburger : They can both satisfy your hunger, while they are two different things with few similar ingredients. NodeJs does not need a web server to run, which is not the case for PHP. One allow to run PHP code in the server-side, and the other JavaScript. It’s true that by using NodeJs you don’t have to learn a new language since it’s plain JavaScript, however you have to learn how to write server-side JavaScript and that’s a totally different thing.
This have been said, the choice of the programming language is a decision which should consider not only the performance of the languages, but also the availability of the developers, salary range, allocated budget … etc.
The table below resumes PHP and NodeJs wins as explained in the article :
PHP Wins | NodeJs Wins |
Mixing code with content | Separating concerns |
Deep code base | Newer code means more modern features |
Simplicity (sort of) | Complexity of closures and more |
No client app needed | Service calls are thinner than HTML-fat PHP calls |
SQL | JSON |
Speed of coding | Raw speed |
PHP has a built-in web server since 5.4
True, but only 32.26% are PHP 5.4 and higher according to this. Notice that built-in PHP web-server is not recommended to use in production (See warning).
You’re right, but if we talk about language capabilities, then PHP is able to run without an external web server. Even if this is not suitable for most of real applications (that are, of course, web applications), this means that you can write a standalone application in PHP, e.g. an application meant to run on a single client.
As you said Massimo, it’s not suitable for most of real applications. Theoretically everything is possible, but practically we have to deal with what we have in hands.
PHP has a built-in web server since 5.4