70% of the world’s internet btw, but out-of-support deployments and little funding for permanent staff to manage the open-source project.

  • Orbital [none/use name]@hexbear.net
    link
    fedilink
    English
    arrow-up
    14
    ·
    edit-2
    2 days ago

    I just had a coder/sysadmin friend UNLOAD on me about the utter garbagehood of PHP. Both barrels. Something is missing in his analysis or mine - if it’s unfathomably junky why is it still around?

    (Note: I’m no expert on this shit just hoping some of the promise of open source will bear fruit by the time we’re all huddled in basements and bunkers)

    • communism@lemmy.ml
      link
      fedilink
      English
      arrow-up
      17
      ·
      2 days ago

      Legacy systems. LAMP stack was the web dev meta for ages. Now people prefer more modern languages, but a lot of web dev will be maintaining an existing website rather than writing a new dynamic website from scratch.

      Also, as another commenter mentioned, WordPress is written in it, so if you’re writing WordPress plugins you’re writing PHP.

    • invalidusernamelol [he/him]@hexbear.net
      link
      fedilink
      English
      arrow-up
      13
      ·
      2 days ago

      PHP is mostly just used because it’s what WordPress uses. If it wasn’t for WordPress, I think PHP would have gone the way of Ruby on Rails a while ago.

      Rust, Python, and TypeScript are becoming the foundation for newer frameworks, but there isn’t really a killer app yet. Plus everyone is used to WordPress and Drupal.

      • PorkrollPosadist [he/him, they/them]@hexbear.net
        link
        fedilink
        English
        arrow-up
        5
        ·
        edit-2
        2 days ago

        MediaWiki is also a huge piece of PHP infrastructure which probably won’t disappear for a long time.

        With the separation of front-end and back-end development, the language becomes less important. The front-end is going to be JavaScript (or TypeScript) because that is the hell Google+Mozilla has consigned us to, but on the back end the only requirement is to throw up some REST API. This can be done in Node, Rust, Go, C++, Python, you name it. With CDNs, load balancing, cloud computing, and reverse proxies, everything is basically required to be swappable anyway. An API can be implemented in Python or Node, then ported to Rust if there is a performance justification. I can’t see a monoculture re-emerging the way things were 20 years ago.

    • trompete [he/him]@hexbear.net
      link
      fedilink
      English
      arrow-up
      10
      ·
      edit-2
      2 days ago

      PHP’s selling point was basically being able to embed into html. That’s obviously possible with any language; it’s not hard at all really, I think you call that a template engine. But PHP had that as its core idea. Many a webhoster enabled PHP in the 90s, meaning it was easier to deploy than other languages, which would have to go through CGI (common gateway interface, a protocol for handing HTTP requests to scripts/binaries, which is how you traditionally interfaced a web request with e.g. a Perl or C program). CGI also spawns a process each time, which is slow, whereas PHP came as an Apache plugin.

      So PHP won over Perl, which had a head start in that space, I think mainly due to convenience and the because webhosters supported it.

      Perl is a better, more well thought out scripting language arguably, but was created as an alternative to Unix shell scripts, and not web-first. Also it’s more complex. PHP is more straightforward and C-like.

      The complaints about PHP, and I share them, is that PHP was not only for amateurs, it was created by amateurs. In some earlier version of PHP, for example, something like this:

      f(g())
      

      would have to be written as

      $a = g()
      f($a)
      

      which is just ridiculous. People had figured that out in the 60s, maybe even earlier, and that had worked in every language since then. The creator of PHP would have to have never read a book or attended a course on language design, garbage collection, compilers, parsing, or probably any other relevant topic. They were totally winging it. In versions 4 or 5, PHP copied, in a cargo-cult like fashion, various object oriented features from C++ without deliberate thought. The built-in standard library, while extensive, was notoriously inconsistent and easy to misuse, further exacerbated by the fact that PHP loves to convert types silently instead of throwing an error.

      It really deserves its place in the hall of fame of the worst languages. Most of the things up there (like Unix shell or BASIC) came way earlier, and at least you can see how and why they are as they are, but PHP is totally born from ignorance (or rather superficial half-knowledge) of what came before.

      It’s still around because frameworks like Wordpress, Mediawiki (Wikipedia) and various legacy websites have not transitioned to something else because it would be a monumental task to migrate all this shit.

    • Soot [any]@hexbear.net
      link
      fedilink
      English
      arrow-up
      8
      ·
      edit-2
      2 days ago

      Inevitably, because it’s trying to be everything to everyone, and the decades of historical baggage, it can frustrate people quite easily due to its conventions and structure.

      That being said, as someone who has done professional web development, the reality is it’s an exceptionally reliable language, very lightweight, easy to prototype, does everything you need, pretty easy to understand and for more complex requirements, it has accumulated a large set of useful libraries over the years. It’s not a coincidence it beat out other languages like ASP.NET and Ruby-on-Rails.

      I’d argue the main reason it’s being slowly overtaken by the likes of Python and NodeJS is that improved hardware is making the efficiency of languages less and less important. Enabling us to use slower, more bloaty languages (don’t get me wrong, I adore Python) because they more easily let you jam in more-resource-intensive but easier-to-implement solutions.

    • arotrios@kbin.earth
      link
      fedilink
      arrow-up
      5
      ·
      2 days ago

      There’s a couple of reasons. It’s easy to learn, especially in comparison with what came before (I still have nightmares about CGI). If you already had HTML locked down, it’s wasn’t a big jump to coding PHP, whereas Javascript was less noob friendly. This meant that a lot of opensource web content management systems got built first on PHP. Wordpress has been mentioned, but that’s ignoring the larger structural CMS systems like Joomla and Drupal.

      At the time these projects were really hitting their stride (2005 - 2010), opensource systems built on a LAMP architecture were out-competing any proprietary language of similar capacity. The only one that came close to PHP’s use was ASP and that was just because it had Microslop behind it. By 2010, PHP had pretty much dominated the existing opensource CMS community, which in turn meant most non-commercial websites and a fair chunk of commercial ones as well had their core interfaces written in PHP.

      Does it have flaws? Absofuckinglutely. But it was the first widespread web programming language that was free, easy to learn, and worked well over 80% of the time across all browsers. Nothing since has really hit that sweet spot of being the right software for the right problem at exactly the right time, which is why its still in heavy use today.

      • Snort_Owl [they/them]@hexbear.net
        link
        fedilink
        English
        arrow-up
        4
        ·
        edit-2
        2 days ago

        Real goats used ASP web forms with visual basic. Anything else is inferior.

        Honestly im still yet to find a web experience as simple as lamp + jquery. I used to be able to shit out websites at mega speed. Back in the days when it was normal to poop out a whole website in a few days