Of the top 10 websites in the world, PHP is partially or wholly powering more than half of them. Wikipedia, Wordpress, online retail.
I have personally created 6 figures of value because I could quickly dump some PHP scripts on a VPS server and start doing business.
My employer makes billions with PHP. It's not perfect, but it's rock solid for gigantic businesses.
Sure you can build yourself perfect shiny web services using modern bleeding edge languages, meanwhile businesses using PHP for decades are innovating and printing money daily.
I'm just calling it for what it is: a broken tool. I'm suggesting we let go of this broken tool and focus on tools that already work great, instead of wasting millions of human work hours on sub-par coding. Sure, you can still make billions with broken tools, but you could also have done that more easily with the right tools.
PHP is inherently stateless, making it easy to scale up. Facebook has had pretty close to a 100% availability rate since launch and PHP is still responsible for large swathes of their functionality.
Most people attacking PHP read a snarky article written in 2012 about PHP's limitations and cannot actually provide reasoning for why it's so awful.
Wikipedia, huge portions of online retail, forums and Facebook. Are these things inherently less secure or available than companies with a "modern" stack? Not really, in fact pretty much the opposite.
I'll let you in on a little secret: your customers could not care less about your shiny modern stack. As long as it's not preventing performance, security and new development then they don't care.
My PHP endpoints respond in <100ms, which to my customers is perceptionally instantaneous. They wouldn't benefit from any shiny modern language at all (but I do use them).
Thats what every Rust-Fanboy says about the C/C++ Ecosystem
They're actually great technologies, but for a very specific scope. Once you're outside of that strictly restricted scope, they're objectively horrible from an engineering point of view. The standard example is building a database with Excel + formulas.
There is a point in this whole thing. Some technologies should whither and disappear, slowly, over time, so that better one can take over. Or they should remain in their very narrow niches. For PHP I'd venture that it should remain a language for hobbyists creating personal home pages.
Related to this, standard, fixed column, steering wheels also were probably responsible for hundreds of billions of dollars of turnover globally.
But I'd still want my car to have a telescopic steering wheel, airbags, and all the modern safety features you find in a car.
The old school fixed column steering wheel should only be seen in museums or in classic cars out on the road with a special license.
And that was a project originally targeting PHP 4 and, by the time I was brought on, had made it all the way up to 5.x.
I mean, yeah, the code is garbage, but if he weren't allowed to write garbage code _he just wouldn't have written the code at all_. If that guy had to sit and learn proper paradigms and server administration and a bunch of other stuff, he would have just gone out and done something else instead.
Yeah, PHP lets you write shitty code (though it also lets you write _good_ code...). But in lowering the barrier to entry as it does, it also lets people who don't know how to write great code turn their ideas into reality. Unlike the suggestion of another comment, I've got a great deal of experience with "saner" languages, but despite PHP getting a bad rap because of its low barrier to entry I still admire PHP as a great equalizer.
So does Java, Python, C and C++. This is also a shallow argument. No language is perfect but PHP still suffer from the same design issues a 10/15 years ago, none of them have been correct and it's perfectly valid to point that out.
> My employer makes billions with PHP. It's not perfect, but it's rock solid for gigantic businesses.
And with C, since PHP is written in C and probably whatever fronts your PHP applications, and with Javascript because you sure ain't running PHP on the client and so on and so forth...
1) It used to be loaded straight into the Apache process as a module, which made it very convenient to get started with but required terrible broken hacks to run multiple applications/users separated from each other in a secure way. But nowadays people are switching to PHP-FPM, which is the same approach used by Python, Java and most other languages.
2) Every possible extension baked right into the language as a global function instead of using namespaces and a package manager like other languages. But nowadays people use namespaces and a package manager, just like in other languages.
3) Templating as part of the core language (in fact the core language is a templating language) so you don't need a separate templating library like in other languages. But nowadays people use separate templating libraries, just like in other languages.
What? Not even close. You can update PHP code by just replacing the files, it's not compiled. PHP-FPM is just a layer that provides a fastcgi interface and manages processes that run PHP. It's super easy to run, super easy to proxy to with Caddy or Nginx or whatever else support fastcgi.
Java is compiled, and typically runs its own HTTP server. Python is not compiled, but usually it runs its own HTTP server, or a WSGI server which adds another layer.
> Every possible extension baked right into the language as a global function instead of using namespaces and a package manager like other languages.
Are you trying to say that global functions are a strength? Namespaces are a big improvement. Many modern PHP extensions provide namespaced classes now, it's mainly the older ones that don't.
Talking about shallow comment you could say that from dozens of languages that have saner foundations.
> There are “better” languages and solutions but they are usually more difficult to setup or not as easy to learn.
No they are not more difficult to set up, not in the era of containers and PAAS. Of course if you still rely on Go Daddy for hosting, it might be...
(Here we go again.) Such us?
If not, you're just proving my original point. It's hard to see the problems of a language if you are only productive in that language. I can start pointing out flaws in PHP, and you can claim that those flaws don't matter. Until you increase the number of languages in your repertoire, our discussion about the flaws of PHP won't be constructive.
If we say once a better language comes along, we should say that the old language is shit and should die, then sure keep doing that. But looking at the languages that you have listed above, none of them are dynamically type I belive although not familiar with a couple of them. For some small projects people might prefer dynamic typing, or if you are prototyping something.
Also the amount of libraries, frameworks and projects already written PHP is massive so if someone wants to do something fast, why limit people's choices by trying to convince everyone that the language is shit instead of letting people decide for themselves? It just feels like a witch hunt to me.
Javascript, PHP, Haskell, Rust, C++ and LISP. I'm familiar with the benefits and drawbacks of all of them and I don't see how any of them replaces PHP
> I can start pointing out flaws in PHP, and you can claim that those flaws don't matter.
It is context-dependent. For some jobs it is a poor choice, for others - including most of web application back-end development - pretty much none of its so-called flaws actually matter.
Go ahead, keep using PHP for your existing multi million dollar product. But using PHP for new projects is not wise.
PHP shops won't attract from the same pool of talent. It's not that there aren't good PHP developers, it's that there are so many brilliant engineers that are never going to consider such work.
Languages matter.
My advice is use the best tool for the job when possible, if you don't have a choice then learn to accept that most of us work with less cool languages/frameworks/projects ... the skill we bring is to find solutions for our customers and implement this solutions as best we can with the tools we have, most of the time a developer should be spending reading stuff(documentation,articles, code), thinking and the least time should be spent on typing code or tooling.
An example would be where a dev needs to implement X, then he goes on Google , finds some code sample , copy-pastes it, tests it, then changes here and there to make it work. The issue is that he maybe forgot to read the documentation for the functions used in the sample, or did not think that the sample is incomplete (maybe missinfg input sanitation) or is outdated or the solution was already in the project code if he only have asked or looked around in the code.
Other example is when a dev wants to solve X, installs a package from npm that does X but does not understand it and in fact that npm package is just a few lines of code that you could have read, learn something, find limitations and improve that.
That's my story, I ignored PHP for years but since I had to work again on it recently and got pretty quickly hit by its "rough edges" I couldn't help but ask myself why such a bad language is still around.
PHP works (thought not perfect) lets me get things done.
For most CRUD web development, using Lua/Julia/Erlang has a heavy cost upfront of learning, finding developers and many other issues like hosting etc. PHP works out of the box on most servers and has a mature ecosytem. So this is why I cannot just get into Lua or Julia because it is much better than PHP. It is all about cost vs benefit analysis. Sure, if I am building something like whatsapp, I should probably learn Erlang over PHP but if I am building yet another CRUD App (which most web apps are even in 2020), I am totally ok with PHP since that gives me the quickest and most mature way to get started.
People who care too much about languages remind me of the "If you have a hammer, everything looks like a nail" situation. Not every application has to be built in Julia/Lua/Rust whatever.
That's probably true. But if PHP is the only language you know, it might still be worthwhile to learn another one, when you have some time to spare.
And "most mature"? Other web frameworks are plenty mature. Django, Rails and Spring MVC are all roughly 15 years old.
I worked with PHP 5.6 years ago and I hated it.
Recently I worked with PHP 7. Heard about all the work that's been done on it and I was kinda excited to try it. It's still so broken. It doesn't matter if they improve performance or add new cool features. PHP is broken in ways that can't be fixed without breaking compatibility. Fork it or put it out of its pain.