Live data from Hacker News

PHP vs Node js... Let's be honest: Node.js couldn't kill PHP. Why?

belitsoft.com

11–20 of 61 posts

Re: PHP vs Node js... Let's be honest: Node.js couldn't kill PHP. Why?

#12

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. 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. If you're a pro and…

When's the last time PHP has been used in this way? Don't people use frameworks these days such as symfony, silex and laravel etc? And then point the web server to the entry point like with any other language?

Re: PHP vs Node js... Let's be honest: Node.js couldn't kill PHP. Why?

#13

#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. 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.

Try now (https://zeit.co/now), I use it and it is very easy to deploy a node.js app. You literally just type `now` in your terminal.

Re: PHP vs Node js... Let's be honest: Node.js couldn't kill PHP. Why?

#15
post #12

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. 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. If you're a pro and…

When's the last time PHP has been used in this way? Don't people use frameworks these days such as symfony, silex and laravel etc? And then point the web server to the entry point like with any other language?

>Don't people use frameworks these days such as symfony, silex and laravel etc

People should, Composer (with PSR autoloading) and nikic's FastRoute get you most of the way to a really nice, lightweight meta-framework barring anything else, for practically nothing. There really is no excuse for the "URL points to a file" model to be a thing anymore.

But a lot of legacy PHP code doesn't do that, and likely a lot of newbie code doesn't, because they follow old tutorials, and that model is faster and simpler.

Not even Wordpress uses routing AFAIK.

Re: PHP vs Node js... Let's be honest: Node.js couldn't kill PHP. Why?

#16
post #9

#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. 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.

TBH, PHP is viable for pretty much exactly as long as Wordpress survives and uses it. If that changed, I wouldn't fancy PHPs chances.

The vast majority of web sites run PHP for better or worse and that code ain't going nowhere.

The performance characteristics of Node are completely irrelevant for most sites. The developments model's inherent complexity and the moving target, however, matters very much.

Re: PHP vs Node js... Let's be honest: Node.js couldn't kill PHP. Why?

#17

#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. 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.

Try now ( https://zeit.co/now ), I use it and it is very easy to deploy a node.js app. You literally just type `now` in your terminal.

> in your terminal

You just lost a nontrivial percentage of PHP developers. Far and away the most compelling feature of PHP for a lot of their target audience is that the deploy model is "unzip this file in that folder". If I want to host my own web site but I don't want to "learn to program" there is no alternative.

Re: PHP vs Node js... Let's be honest: Node.js couldn't kill PHP. Why?

#18
post #4

I have successfully run node.js applications on a hosting account which supported fast cgi for Rails applications. 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. Here's a similar library: https://www.npmjs.com/package/node-fastcgi

Lucky with the provider?

This was a couple of years ago, but the provider was Bluehost. While I had shell access and a compiler, I only used it to compile the node binary and make the main js file executable with a hashbang.

Re: PHP vs Node js... Let's be honest: Node.js couldn't kill PHP. Why?

#19
post #17

Earlier quoted context omitted.

Try now ( https://zeit.co/now ), I use it and it is very easy to deploy a node.js app. You literally just type `now` in your terminal.

> in your terminal You just lost a nontrivial percentage of PHP developers. Far and away the most compelling feature of PHP for a lot of their target audience is that the deploy model is "unzip this file in that folder". If I want to host my own web site but I don't want to "learn to program" there is no alternative.

> unzip this file in that folder

it's more like "copy these files via ftp to this host" (p.s. that also includes your config.php with plain text passwords of course)

Re: PHP vs Node js... Let's be honest: Node.js couldn't kill PHP. Why?

#20
post #19
post #17

Earlier quoted context omitted.

> in your terminal You just lost a nontrivial percentage of PHP developers. Far and away the most compelling feature of PHP for a lot of their target audience is that the deploy model is "unzip this file in that folder". If I want to host my own web site but I don't want to "learn to program" there is no alternative.

> unzip this file in that folder it's more like "copy these files via ftp to this host" (p.s. that also includes your config.php with plain text passwords of course)

Well, yeah. Point being that if I'm used to working with .doc and .xls files there's next to zero new skills I have to learn and nothing that really pulls me out of my comfort zone. I just have to install a text editor ("like Word, but for .php files") and an FTP client ("type this magic string to set it up, then it's just a funny looking file browser") and I'm off to the races.
Post reply on HN