Ask HN: Why Isn't PHP Dead Yet?

11 points by 01-_- 4 months ago

PHP Should Be Dead… So Why Are Developers Still Building Amazing Apps With It?

Everyone loves to dunk on PHP. New devs sneer at it. The community treats it like a relic. Even after its latest update, many still consider it a "bad" language.

And yet… people keep using it. Not just using it—building successful, scalable, money-making applications with it.

If PHP is so awful, why hasn’t it died? What’s keeping it alive while so many other languages have faded into obscurity?

Let's hear it—why is PHP still standing?

codegeek 4 months ago

"PHP should be dead"

Says who ? PHP works. Has a great ecosystem. A hell of a lot more stable than JavaScript ecosystem and package management. Tons of investment in frameworks like Symfony and Laravel. Great out of the box Hosting options. It just works. Upload index.php and boom. Then you have the beast: WordPress.

Don't get me wrong. I like other languages too (except JavaScript). There is a place for every language and PHP is no different.

I honestly think that PHP haters are just jealous because its supposed to die (in their own minds) but they are not able to accept that it is everywhere.

  • muzani 4 months ago

    "except JavaScript"

    This might be the most accurate answer in the thread lol. It's like the river and the sea, there's just a barrier between them with entirely different ecosystems.

  • DimmieMan 4 months ago

    "says who"

    Says the likely majority of us who've only experienced WordPress.

    The experience of having to fix your companies hodge podge of dubious quality plugins in an antiquated code base. Then there's the legacy PHP applications...

    I'm not actually rejecting your point as such, Laravel is on my to look kick the tires list and modern PHP looks fine but I can empathise with anyone that comes out with the impression its an awful technology.

    "I like other languages too (except JavaScript)."

    Situation seems similar come to think of it, ~ last 5 years of tooling & language features compared to what it was 10 years ago might as well be different language & ecosystem. Not suggesting everything is fixed in JS/TS land but as long as you remain dubious of anything from Vercel or Meta things aren't that bad.

  • 01-_- 4 months ago

    that was the most fantastic approach here. You're completely right

toast0 4 months ago

PHP isn't dead because it's a language that can meet you where you are.

There's lots of onramps, like shared/control panel hosting where it will just be there and/or wordpress where you want a customizable blog and now you're writing php.

There's a middle ground of frameworks and stuff.

You can write pretty darn fast web pages with just the php language if you're careful.

PHP extensions aren't the easiest language extension I've used, but you can really speed some stuff up if you need to, or interface with libraries/functions that don't have a php interface already.

And then if you're facebook, you can do Hack.

Sure, people love to hate it, but it's going to stick around for a long time because it's good enough, it's very available, it works at all these levels, and it's not tied to any particular enterprise.

  • askonomm 4 months ago

    PIE (https://github.com/php/pie) has made PHP extensions also very simple. Still relatively new, but by the PHP foundation and definitely the way forward.

babyent 4 months ago

There are no bad languages. Only bad engineers.

An engineer should be able to solve any problem given any tool. Unlike other disciplines, when we are given a hammer everything does become a nail.

But a bad engineer will strike the hammer poorly and bend the nail, and blame the hammer.

soumikmahato 4 months ago

PHP is already in mature stage, it has integrated support for many libraries like MySQLi, PDO, curl etc.

A huge community is also a major plus point.

And the foremost point is because of WordPress which run on PHP, it's empowers 62.8% of the web including big sites like Tech Crunch.

Third and more practical one is because of old conservative developers who are very resistant to change.

Also it is supported by many web hosting provider by default, due to its availability and integration with cpanel and WHMCS. Thus many personal blog owner prefer php.

matt_s 4 months ago

Replace PHP in your post with most any other older open source language and its likely the same reasons: it works, there's lots of docs, the community is huge, there's a large ecosystem, etc.

Any language has potential to have horrible or wonderful code written in it.

  • 01-_- 4 months ago

    but sometimes we even lose out on jobs because we're loyal to php. Especially for freelancers :(

    • bayindirh 4 months ago

      Adding tools to your toolbelt is part of the craft, no? You can add another language to your roster without abandoning PHP. I used to write PHP, and will write it happily after a refresher if I need to.

      However, I learnt ton of languages after I learnt PHP. That shouldn't be an issue.

      On your question, PHP is alive because of the same reasons why FORTRAN and even COBOL alive. It's useful.

    • matt_s 4 months ago

      If you're a freelancer you're subject to what your customer wants. If you built custom decks and people started to not like the materials that they bought from you and you constructed, you'd have to change materials to stay competitive.

solardev 4 months ago

It's pretty likely a PHP site written 5 years ago still works fine today. Javascript? No way.

hilti 4 months ago

It's easy to deploy. A lot works out of the box without having to install any 3rd party libraries (PDO database access, CURL, file and directory management, session management etc.) And for most tasks it is fast enough.

shams93 4 months ago

Once people realized its actually more secure and performant than java you saw big companies using it such as Disney Parks. This was new they had been using java for at least a decade before moving to php for developer productivity. I used to write java for them and you had only a test server, you had to know the language well because you had to wait 30 minutes for your servlet to compile in a compile wait list on the server. With php you could easily test locally, and they used php off the shelf so you no longer needed to know all the quirks of Disney's proprietary Tea servlet templating system.

anon743448 4 months ago

PHP is the fastest and cheapest way to get MVP out the door.

Sure there are fast ways to get MVPs out with other languages like Vercel for JavaScript etc. But that is not cheap. And sure you can get a pretty cheap VPS but setting it up for anything non-static websites is time consuming and has potential for errors.

With PHP, you can have your proof of concept out in public for almost free and almost immediately. And once it is working, why bother rewriting the app in a better language unless you run into some kind of limitation.

  • adamtaylor_13 4 months ago

    _Laravel_ may be one of the fastest ways to ship an MVP, but raw PHP most assuredly is NOT.

    • anon743448 4 months ago

      Indeed. For most projects, you want to start with a framework but that applies to almost all of the languages.

    • 01-_- 4 months ago

      why? if I can get to know my code better through it

      • adamtaylor_13 4 months ago

        Shipping an MVP != "knowing my code"

        I don't know what 99% of the internals of Rails is doing, but boy howdy I can outship you every day of the week using Rails compared to any custom setup.

        Rails/Laravel == I want to make money. 100% Custom code == I want to build something intellectually gratifying.

        I won't say they're never the same, but very VERY rarely is that the case.

  • 01-_- 4 months ago

    but tell me, a better language in what? it's exactly this doubt that I want to clarify

    • anon743448 4 months ago

      There are some inconsistencies between function names and some quirks. I haven’t used PHP for a while, so cannot recall exact issues. Based on other comments, it seems PHP has resolved many of these problems.

      I think most of people saying that other languages are “better” are just repeating outdated information.

marto1 4 months ago

It made a lot of really good choices in the late 90s when a lot of dot-com companies started and a lot of people around the world started getting interested in making their own websites. It eventually snowballed to the LAMP stack which became the most user friendly way of doing stuff on the web on low budget. The inertia from this is massive so it's staying for a bunch more years.

bediger4000 4 months ago

Because it's not really that awful. You can knock out something useful very quickly, and if you're careful and have a little discipline, you can indeed maintain it. The almost infinite library probably has something to do with it, as does a teeming mass of developers that have a familiarity with PHP.

  • 01-_- 4 months ago

    and that's why giant sites like wikipedia are still alive and kicking

bloomingkales 4 months ago

So long as there is something that loves something, that something will exist. You can keep anything alive if you heart wants to. Some people really love PHP, and that's kinda beautiful.

  • 01-_- 4 months ago

    I'm one of them. Almost everything I build for the backend I do with php

    • bloomingkales 4 months ago

      Why do you love it?

      • 01-_- 4 months ago

        > 'Replace PHP in your post with most any other older open source language and its likely the same reasons: it works, there's lots of docs, the community is huge, there's a large ecosystem, etc. Any language has potential to have horrible or wonderful code written in it.'

        why else wouldn't I love her?

icedchai 4 months ago

With frameworks like Laravel, PHP can be super productive, especially for basic CRUD apps. Also, it is incredibly simple to deploy compared to a more "modern" cloud stack.

  • 01-_- 4 months ago

    I would go as far as to say that it has the same level of scalability as nodejs

    • gjsman-1000 4 months ago

      Whenever someone says PHP doesn’t scale - just point to Wikipedia or any NSFW site ever as proof that’s baloney. Facebook and Slack still use tons of it internally.

      If someone says server-rendered HTML doesn’t scale or hurts conversion, or that we truly need a SPA to maximize sales - just point to Amazon and eBay, as proof that’s baloney.

      Most colloquial programmer wisdom, I have learned, is baloney.

yulaow 4 months ago

easy to deploy, latest versions of the language are ok, has some of the best web frameworks to work with, absurd amount of experienced programmers can be found on the market

zepolen 4 months ago

Because it's easy to deploy, that's the only reason.

krapp 4 months ago

¯\_(ツ)_/¯ The only languages no one hates are the ones no one uses. Hating PHP is a mostly a meme and an elitist virtue signal, and people still use it because it still works. Simple as.

  • 01-_- 4 months ago

    well said :)

quintes 4 months ago

PHP works, quick to build quick to deploy

  • naveed125 4 months ago

    Also Laravel is pretty awesome NGL

keiferski 4 months ago

One word: WordPress.

  • solardev 4 months ago

    And MediaWiki (Wikipedia) and Drupal too.