#1 reason the article doesn't mention: It's incredibly cheap to host PHP. Hosting companies push WordPress and other PHP-based hosting heavily and make it super easy for anyone to get a live site going with PHP.<p>Last time I launched a node app, it took me a full day of messing about in AWS. Last time I launched a PHP app, it took me less than a half hour at Siteground.
Node was not built to kill or replace PHP, so why should it?
I mean even C++ didn't kill or replace C. Both languages can coexist, I like em both.
I maintain a mountain of PHP. What attracts me to JavaScript is its syntax:<p>PHP:<p><pre><code> $fruit = array('apple', 'banana', 'orange');
$fruit_colors = array(
'apple' => 'red',
'banana' => 'yellow',
'orange' => 'orange'
);
</code></pre>
JavaScript:<p><pre><code> var fruits = [ 'apple', 'banana', 'orange' ],
fruit_colors = {
apple: 'red',
banana: 'yellow',
oranage: 'orange'
};
</code></pre>
That's like 20,000 fewer keystrokes and much easier to read. My favorite new feature in PHP is the short array syntax.<p>Even those less minimalistic than me, I think the draw to Node is the language, the consistency of having the same language front and back.<p>Much ado is made about which one is faster. But I would say roughly 99% of web apps are CRUD apps, with a few users per hour, and the bottleneck would be the database anyway.<p>For me what PHP has going for it is my familiarity with it. Plus, despite all the nitpicking articles, it is rock solid, especially compared to Node. And compared to Node, PHP is a hyper-organized library of everything you need, just an arm-length away.
PHP uses an imperative programming model and has a very clear URL->source file mapping. This means you can look at the URL, find the source file, start at the top and trace your way to the problem.<p>Node (and Rails, and Java and lots of others) use a declarative router. The app boots. Shit happens. Routes exist. Middleware is involved. There's no way to know what code is implicated in a given URL.<p>If you're a pro and you can afford to spend a year or so learning framework internals while not getting much done, you develop a sixth sense for where in the codebase an error is likely to be, but you need to spend many weeks and months scratching your head to get there.<p>PHP is much more beginner friendly in this way.
I can't take this article seriously when it shows a survey at the top claiming to show a stack overflow developer survey for back-end technologies that lists Javascript at 54% happiness, and then further down it lists nodeJS at 14% happiness. I guess the other 41% were using io.js.<p>Apparently people are also happier using angular on the back-end. Which makes no sense. Also, pretty sure WP still runs PHP on the back-end. So much inaccuracy here.
I have successfully run node.js applications on a hosting account which supported fast cgi for Rails applications.<p>Unlike normal node.js applications, the process is started and managed by the provider's web server and applications can be uploaded using a standard FTP application.<p>Here's a similar library:
<a href="https://www.npmjs.com/package/node-fastcgi" rel="nofollow">https://www.npmjs.com/package/node-fastcgi</a>
Due to the ubiquity and ease of hosting PHP, and the current shift to full-stack JavaScript frameworks, I predict a long transition period where various "bridges" will be made to interface between the two. Mainly I'm thinking of PHP-side exposing content via REST APIs, with a more modern frontend written all in JS.
Asyncronous thats the difference. Nodejs its asyncronous, thats powerfull but its a nigthmare to control it in a crud database api. We try to change from php to nodejs in 2016 but async was the difference.