Outside of the HN echo chamber, PHP is still what drives a lot, probably most of the web. Wordpress alone accounts for 30% of websites [1].
That translates to easy access to labor for a lot of companies. If you want a quick web app stood up, you can have your pick between a few hundred thousand hungry PHP devs or the three node.js devs that are currently considering being available for new work.
...'course, a lot of those cheap PHP devs will turn out some horrifyingly bad code, but that's not PHP's fault, and most businesses don't care.
I didn't look for numbers to back this, but I'm not sure node is that far behind in term of available developers (clearly not three vs hundreds of thousands), there is an enormous amount of Javascript developers today, and even those who do not use node can be ready for simple server-side development in a matter of days.
Wordpress powering most of the web is not necessarily a good indicator of the popularity of the language among developers, as the whole point of Wordpress is that you do not need to be a developer to operate your website.
You can get $5 shared webhosting anywhere and use php. Or apt-get the php Apache module and be ready.
The barrier to entry is very very low (for better or worse), and if you're careful and avoid most of the crazy, you can make really fast , low overhead, lightly dynamic pages. Of course, it also gives you more than enough rope to get yourself into a lot of trouble, and I have feelings about the modern trend of obfuscating things with frameworks and autoloads, but lots of people think they're great.
This, absolutely this. There's literally nothing to configure or setup beyond PHP itself. You open a text editor and write your script, save the file, drop it on the server and it's immediately ready to run. No messing around with convoluted toolchains, massive frameworks, or some elaborate "build process" just to get a "Hello world" to work.
I'm not sure if it's even a majority of users, but PHP certainly appeals to those of us who like writing plain HTML in a text editor and being able to immediately refresh the browser that has it open to see the effects of changes.
The language itself has its warts, but they're easy to avoid and IMHO the disadvantages pale in comparison to the extreme simplicity of getting started and continuing to work.
Can you show some data? I'm interested to see how exploitable popular PHP frameworks (Laravel and Symfony?) and the language itself are over the years in comparison to JavaScript, Python and Ruby web stuff. Not interested in anecdotes or bad code from bad programmers (aka Wordpress plugins) being used as an argument.
My company has some legacy PHP stuff that is rock solid, making money for years, survived every single audit (and PHP 7 cut our server costs by half).
Still waiting for source for all those claims. I'm not being ironic or anything but people throw things under the bus so easily it would be nice to see the data (comparison).
Their numbers are huge so of course the number of exploited servers will be higher in raw numbers, but is the core "extremely" exploited or is the plugins the real problem? We should be talking about the language/merits but I'll listen to arguments about the ecosystem. Just feels really dumb to talk about things like plugins. It's like saying JS is crap because 70% of the web extensions written in JS are sold to the botnet or are pure crap. Or how a popular operating system has more CVEs because it's popular. Not sure how to explain better what I want to say so let's just leave at that.
Having the possibility of using a cheap hosting service like hostgator (for instance) is one of the biggest advantages of using something mainstream like php.
It's not about control it's about ease of use. You can get a cheap shared hosting account and upload your php site in minutes without configuring a thing. Not everyone wants or needs to manage a server.
Think about a small business with no tech experience that just needs a basic marketing site. They download some cheap Wordpress theme, make it say what they want and upload it. Easy! Digital Ocean would be a disaster for them.
This is 100% true, and furthermore, the process you just described is still too complicated for millions of businesses. They just make a Facebook page (or maybe a Shopify/Wix site) instead.
I think PHP is interchangeable with PHP, ROR, and node (i.e. give me a line in any of them, and there's a one-liner in the other to do the same thing) [this wouldn't be true for something like Scala].
So, presumably for the same reason somebody would do a project in ROR.
Every topic that PHP was mentioned in years has comment like yours basically reduced to "PHP sucks". Everybody already knows there are people who think PHP sucks. If you think PHP sucks, don't use it. Stop wasting your time by going to topics where people discuss things about PHP only to proclaim that PHP sucks. It's not contributing anything. Just spend that time doing something useful.
You are missing the point. I am not saying Php is crap for the people already who know it. I am saying Php is crap for people who are new to programming and don't know to stay away from Php yet...I thought I made it clear in the last comment.
There's a ton of basic CRUD apps and REST APIs being written in node for which the event-driven model is useless at best, and actively harmful at worst.
Looking around at actual production node code, huge swathes of it could easily be written in Rails, Django, or Symfony with no real loss of performance or developer productivity. (And given the maturity of those ecosystems, probably a net gain in developer productivity. Example: ORMs aren't great at everything, but sometimes they save you a lot of time, and Node doesn't have an ORM that can compare to ActiveRecord, Doctrine, or SQLAlchemy.)
CRUD is literally what node.js is built for - lightweight APIs that then have to do some slow operation async against a store - which they overlap requests across with an event-driven model
Yes, and it doesn't have a big enough advantage for it to be picked up. Usually developer productivity and memory use (node doesn't cause memory leaks but it doesn't prevent them either) is more of a limiting factor than the execution model.
Node has found plenty of use outside of what it was originally built for (the canonical examples are web servers). As far as I can tell, it's used more widely and critically as a tool for packaging client-side scripts or for client-side applications (vscode, electron, Slack).
Examples of places where it seems like node would be an obvious choice, but it's not: blogs (WordPress still reigns), Mozilla's Add-ons (runs on Django [1]), Slack (very heavy user of JS on the front end, but backend is coded in PHP [1]), Zapier [2] (Python backend, though custom integrations are often written in JavaScript)
RoR changed the entire scene with convention over configuration and a total commitment to developer productivity. It's still top of the line in that regard. There's nothing out there that will get you from concept to market faster with a polished product.
Even as a giant fan of Elixir, Rails still has a firm place in the "choose for a new project" bucket.
I'd use Laravel over Rails for a new project in 2018. The community is more active and correspondingly the freebies more modern. Rails' front end story became a ghetto once SPAs became a thing.
No inherent advantage, but Laravel shipping Vue as a default requires 0 config and the community has crystallized around it as a result, whereas Rails' Webpacker isn't a default in the install and puts the onus of choice on the developer (no convention over configuration there) for framework, structure and best practices.
If you're an experienced dev, this is a nitpick. But for new users, this is a major hurdle.
Edit: as an aside, I'd rather use Rails or Laravel for an api unless the backend had to be a set of microservices for some reason. Less time writing architecture, more time writing biz logic :).
well not everyone needs to do something just so they can be marketable to other people
and when that isn't a concern, a stable well maintained language and framework is good enough. PHP has gone through a seemingly endless stream of vulnerabilities but if you actually patch your stuff then its fine.
for a web service or site, if you set your routes then nobody would see file extensions and would never know you are using PHP, so when you throw on the trendy bootstrap GUI on top, no one is the wiser and it performs just as well.
PHP may seem like an anathema solely because of its correlated and predictable use by out of touch fortune 500 companies that have vulnerabilities and horrible GUIs. But that isn't the fault of PHP.
I know many devs who do not want to waste their days reading/watching vids about whatever the latest fad to do X is. Node and ‘modern frontend’ suffers from that a lot; many people pick PHP because although it might not be the latest and greatest thing, it works, it is stable, it is fast and you can just buy a few years old book and create something that fulfills the business case. And there are many programmers available with serverside experience for PHP (sorry but frontend JS just is not the same as serverside, so it is common to see nightmare code running in Node that was clearly someone’s ‘but I know JS so I am backend ninja now!’).
Personally, since .NET Core 2.1 (latency dropped and the performance is phenomenal on Linux), which is a pleasure to write for, deploy with and very stable, I do not look too much at other things.
Could you elaborate why/how other alternative are better? Why PHP is bad for a new project? Or PHP just doesn't sound cool to you?
Of course you got downvoted (I have never used PHP but I also downvoted you) simply because you do not say any reasoning on your claim and thus there is no value in your comment.
I wouldn't either and I've worked with enough PHP to know I never want to involve myself with it again. But I can understand why it sticks, especially in organizations that want to keep costs down and get something (even with questionable quality) out the door as quickly as possible.
PHP 7.0+ is better than Ruby imo. I enjoy it more at least.
It's got type hinting, is more explicit, maps, filters, lambdas, easy setup/transferability, and more.
Also, Laravel is miles better than Rails.
I think any of the little dynamic programming langs like Ruby, Node, Php, Python are more about the builder than the tool
the only logic flaw here is...if php is slightly better than ruby and whatever you think, then why not already use the languages slightly or more better than php? many languages that are miles better
Laravel the framework is better than Rails the framework imo.
To answer your question, it doesn't really matter at the end of the day.
There's tools in every web language to do just about anything you need web wise. A competent programmer can switch between OOP langs and in a week or two be writing proficient code.
Really it all comes down to preference at the end of the day in the dynamic OOP web world.