by jaequery · 9y ago · 0 comments
The usage you see are mostly from people already invested in PHP. However, I'm starting to see fewer new PHP devs. Some of the talented devs I know of have migrated to other "cool" languages. There are fewer PHP jobs than they use to be. I also observed less activity in PHP related subreddits. Its position as the #1 web server language has already been taken over by nodejs, and the remaining chunk eaten by Go, Python, C# (as ms tech goes open-source) and other languages. I dont see PHP going away anytime soon, but I dont see it gaining more users over time.
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.
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.....
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."
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).
With the "https everywhere" movement, the same is practically true for node. You will likely be configuring some outside proxy/webserver.
Almost every PHP dev I knew did his own CMS and they were mostly horrible blobs of code and the "big" projects weren't any better. TYPO3 and WordPress were a mess and they were considered the industry standard...
I worked with code-bases that had files with 10k lines.
Everyone had to reinvent the wheel and all were bad.
It was like when someone started programming, they read somewhere that PHP is easy and so they started with it and since it was so easy to get the first "dynamic page" in the wild, they didn't bother to learn much about software engineering and even those who did simply followed the patterns blindly and ended up with the same mess, but different.
Somehow Node projects do better and I guess it's because there are more resources out there to "really" learn how to do things. On the other hand I have the feeling people are getting less independent. Some are crying for better docs or tutorials, while I figured it out while reading the source or browsing a few minutes on issues.
15 years ago (when, BTW, Python was already a thing) you _had_ to use PHP, unless you had extra money to spend on a more "scalable" technology (so enterprises, who had money, frequently chose Java). It was a monopoly like JS was/is a monopoly - you want to write code for a browser - you'd better know JS. Now, between AWS and DO, you can with relative ease start up in Go, Node, or Python, and there's no need for PHP.
There'd be a lot fewer node jobs if you managed to exclude all the ones that used express. :)
PHP itself has absolutely nothing to do with this.