4 ms·
> Its position as the #1 web server language has already been taken over by nodejs How so? Because when I put a PHP script on a server with "<?php echo 'Hello
by WA 9y ago
> Its position as the #1 web server language has already been taken over by nodejs
How so? Because when I put a PHP script on a server with "<?php echo 'Hello world' . date('Y' time()); ?>" that is a one-liner and I'm sure it'll work for the next 20 years.
With nodejs, I have to implement the whole webserver and then my web app is also a server, even if it's "only" 20 lines of code and I need other tools to make sure that this server never crashes or automatically reboots and all that stuff.
Imho, the main benefit of PHP is: You can write a script today and because the language is mature, it doesn't change all the time and you can be quite confident that it'll keep running for another decade.
- mmcnl 9y agoWith PHP you also need to implement a webserver (Apache), so you're one-liner is also actually not a one-liner at all. Also, pick the right tool for the right job. Who writes code these days that silently sit still for a decade? Hardly anyone. And even if you do, I don't think Python or Node will suddenly stop working (as you're implying).
- tyingq 9y ago>With PHP you also need to implement a webserver (Apache), so you're one-liner is also actually not a one-liner at all With the "https everywhere" movement, the same is practically true for node. You will likely be configuring some outside proxy/webserver.
- vatotemking 9y agoFYI you can enable https without the need for an external webserver
- vatotemking 9y ago> How so? Because when I put a PHP script on a server with "<?php echo 'Hello world' . date('Y' time()); ?>" that is a one-liner and I'm sure it'll work for the next 20 years. Web hostings have abstracted this for you. In reality, you need to install Apache or Nginx first. PHP does have a built-in server but its for testing only not production. Nodejs is both a server and a webapp. You just need to install nodejs at bare minimum to run a "hello world". Try installing nodejs and php on DO to see what I mean. With regards to nodejs overtaking PHP, various stats from various sources back this up. > it doesn't change all the time and you can be quite confident that it'll keep running for another decade. Now thats just false. The switch to PHP7 from PHP5 alone has many BC breaks. Latest Drupal is a rewrite. Laravel LTS dont last "a decade". Code breaks all the the time in PHP land. The only thing that dont change in PHP world is WordPress.....
- likeclockwork 9y agoYou can't have it both ways. You can't pretend that backend web development isn't software development when it's convenient and assert that it is when it seems prestigious. Your example doesn't account for any complexity. All it seems to say is "You don't have to think about architecture or platform, you can pump out thoughtless abandonware with ease."