• jagoan@lemmy.world
    link
    fedilink
    arrow-up
    150
    arrow-down
    1
    ·
    11 months ago

    Isn’t Wordpress powering like 40% of the internet? PHP isn’t going anywhere anytime soon.

    For me the weirder part of that meme is Python in 2022?

    • Zeppo@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      59
      ·
      edit-2
      11 months ago

      12 years after we learned Flask. 19 years after Django, which also was apparently hot 2 years before it was released.

    • EnderMB@lemmy.world
      link
      fedilink
      arrow-up
      16
      arrow-down
      2
      ·
      edit-2
      11 months ago

      IMO, Ruby is a better Python than Python. It’s simpler, has a cleaner syntax, and if you want to do funky stuff metaprogramming can allow you to do cool, and sometimes unspeakable things. Python has great library support, and slowness and Rails did make Ruby unpopular for a bit, but I would love to see a Ruby resurgence that wasn’t to do with Rails, because it is truly a lovely language to use.

      Hell, I would say that in 2023, it’s easier/faster to get something set up and working in Rails than it is with frameworks like Symfony, Express, ASP.NET, etc.

        • nilloc@discuss.tchncs.de
          link
          fedilink
          English
          arrow-up
          9
          arrow-down
          2
          ·
          11 months ago

          There are literally dozens of us.

          Ruby feels a lot like writing poetry. Especially with microframeworks like Sinatra.

          Python feels more like writing JS/ECMAScript without any punctuation.

          Then again I cut my teeth on Actionscript (1 ugh, 2 ooo, and 3 nice—oh the iPhone doesn’t support it…), so my opinion is probably pretty worthless.

          • folkrav@lemmy.ca
            link
            fedilink
            arrow-up
            4
            arrow-down
            1
            ·
            11 months ago

            Python feels more like writing JS/ECMAScript without any punctuation.

            I don’t know Ruby enough to judge, but I’ll have to say, hard disagree on this particular statement for me. JS to me feels like a bastardized C with some functional-inspired syntax tacked on top, while Python feels like writing English.

        • naught@sh.itjust.works
          link
          fedilink
          arrow-up
          3
          arrow-down
          1
          ·
          11 months ago

          Optional parens on function calls, implicit returns, curly brace procs with args in vertical bars 🙃

        • EnderMB@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          11 months ago

          I’d wager that most people haven’t used Ruby in anger, so don’t really have the comparison. Those that have used it have probably only used it in a Rails context, which IMO is a fairly limited environment to really play with Ruby.

          I definitely love the language, but the ecosystem, library support, and some of the companies that jumped on the initial Rails bandwagon can be extremely backwards and resistant to change in tech.

    • Kerandir@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      11 months ago

      Can you elaborate on the python part? I’m not a programmer ( I don’t work in the field but I studied programming in high school) but I see python mentioned everywhere, is the language obsolete?

      • jagoan@lemmy.world
        link
        fedilink
        arrow-up
        6
        ·
        11 months ago

        It’s not obsolete, it’s very good, still is. Just that Flask and Django both built on top of Python. So if it’s like late 90s or early 00s. Definitely before either Django / Flask. Python isn’t the new and thing of 2022.

  • vsis@feddit.cl
    link
    fedilink
    English
    arrow-up
    80
    ·
    11 months ago

    There are two kind of programming languages:

    1. The ones everyone complaints about
    2. The ones nobody uses.
  • lankybiker@lemmy.world
    link
    fedilink
    arrow-up
    70
    arrow-down
    6
    ·
    11 months ago

    PHP is amazing

    If you’re thinking of PHP version less than 8 you need to have another look

    Totally stateless. Uncached server side rendered response times in double digit milliseconds.

    Types

    Extremely battle, highly tested frameworks.

    Excellent tooling for tdd, bdd, static analysis, automated browser testing, coding standards and auto fixing. Even fully automated refactoring for things like package upgrades (Rector)

    Regular, solid, releases bringing updates and fixes

    Arguably one of the best package management systems, Composer. And only one, none of this constantly changing tooling that some other ecosystems seem to do

    Properly open source platforms to power all kinds of web projects from e-commerce, CRM, social, scraping, analytics, monitoring, API, CMS, blogging

    Basically if your target is server side web stuff then it’s really good

    Or, you can continue to demonstrate how out of touch you are by continuing with the old “PHP bad” jokes if you want!

    • 342345@feddit.de
      link
      fedilink
      arrow-up
      22
      arrow-down
      2
      ·
      11 months ago

      Uncached server side rendered response times in double digit milliseconds.

      Thirst thought, that sounds slow. But for the use case of delivering html over the Internet it is fast enough.

        • aksdb@feddit.de
          link
          fedilink
          arrow-up
          4
          ·
          11 months ago

          For a bit of templating? Yes! What drives response times up is typically the database or some RPC, both of which are out of control of PHP, so I assume these were not factored in (because PHP can’t win anything there in a comparison).

          • naught@sh.itjust.works
            link
            fedilink
            arrow-up
            4
            ·
            11 months ago

            Anything under like 100ms load is instant to the user, especially a page load. It’s a balancing act of developer experience vs performance. To split hairs over milliseconds seems inconsequential to me. I mean, PHP requires $ before variables! That’s the real controversy :p

            • aksdb@feddit.de
              link
              fedilink
              arrow-up
              4
              ·
              11 months ago

              Anything under like 100ms load is instant to the user, especially a page load.

              True, but it accumulates. Every ms I save on templating I can “waste” on I/O, DB, upstream service calls, etc.

          • jaybone@lemmy.world
            link
            fedilink
            arrow-up
            1
            arrow-down
            2
            ·
            11 months ago

            If it’s stateless and nothing is kept in memory, can you have a connection pool?

            • aksdb@feddit.de
              link
              fedilink
              arrow-up
              1
              arrow-down
              1
              ·
              11 months ago

              If you run it in old-school CGI mode, no, because each request would spawn a new process. But that’s nowhere near state-of-the-art. So typically you would still have a long-running process somewhere that could manage a connection pool. No idea if it does, though. Can’t imagine that it wouldn’t, however, since PHP would be slaughtered in benchmarks if there was no way to keep connections (or pools) open across requests.

    • gkd@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      11 months ago

      On the note of testing, Pest is still one of the best testing options I’ve seen across a variety of langs.

  • pixxelkick@lemmy.world
    link
    fedilink
    arrow-up
    65
    arrow-down
    1
    ·
    11 months ago

    It’s hard to justify using anything other than JS or if you wanna be fancy, Web Assbly, for the FE.

    Any other front end language involves generating Javascript from your language, which inevitably ends up with you making a weird Frankenstein project that mixes the two.

    I’d rather just use stuff like Webpack or Vite to compile my JS front-end out of JS (or TS) from the start. It always ends up being a cleaner result.

    My backend though can be whatever the fuck I want it to be.

    But if you ever think dynamically compiling/transpiling a JS front end on the fly on demand is a good idea, instead of simply just delivering static pre-compiled/transpiled pages, you’re part of the problem for why the web is so slow and bloated.

    It’s wild how crazy of projects people will build that take 3 entire seconds to just deliver a 500kb static form that doesn’t even need angular to do anything. They turn a couple hundred kb into several mb for no useful reason, it’s wild.

      • pixxelkick@lemmy.world
        link
        fedilink
        arrow-up
        18
        arrow-down
        1
        ·
        11 months ago

        I prefer html personally :x

        But yeah, I mostly blame the project managers that encourage this behavior, it’s wild how much overengineering goes into basic stuff like making mostly static websites.

        • derpgon@programming.dev
          link
          fedilink
          arrow-up
          7
          ·
          11 months ago

          Same, plain old HTML, and if I need some reactivity then Stimulus. And if need even more reactivity, then VueJS / Alpine. If the form can’t be submitted via a regular submit button, it infuriates me.

    • Tekhne@sh.itjust.works
      link
      fedilink
      arrow-up
      9
      arrow-down
      2
      ·
      11 months ago

      To my understanding, you can’t really use WebAssembly for the frontend - it doesn’t support manipulating the DOM, so you still need to offload a lot of the work to JS. It’s an uncontested language when it comes to web frontend.

      • r1veRRR@feddit.de
        link
        fedilink
        arrow-up
        11
        ·
        11 months ago

        It does support it, it’s just slower than JS. WA is faster in other aspects though, so frameworks that compile to WA (like the Rust framework Leptos) still end up being faster than a lot of JS ones.

    • araozu@lemm.ee
      link
      fedilink
      arrow-up
      3
      ·
      11 months ago

      I find that the only reason for SSR existence is to be able to just move a JS frontend to the backend for SEO/client performonce reasons with almost no effort. If the frontend really needs to be highly interactive then yeah, a FE framework makes things easier. But then you are locking yourself to using JS in the backend. Voluntarily locking yourself to use an objectively bad language.

      Then there are the react/angular/other people, who build everything in these frontends.

      I really hope tools like htmx gain traction, since it looks like a model able to solve the current JS madness.

      • pixxelkick@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        11 months ago

        I’m not liking htmx, I checked it out, it seemed promising, but it has giant gaping security holes in it so I can’t endorse it.

        I have been sticking to using Ejs with html-bundler-webpack

        The combo is lightning fast and gives me a solid usability of html partials so I can modularize my front end in re-useable chunks.

        It compiles to the static site fast for iterative development, it has everything I need baked in for common needs (minification, bundling, transpiling, cache busting, integrity, crossorigin, tree shaking, etc etx)

        I like how it let’s me just focus on actually writing the html + js + css and not have to muck around with thirty boilerplate steps to just make the app run.

        If I need a lot of reactivity I’ll use vue or angular but I so so rarely need that.

        And now with the template element, half the time reactivity can just be done with those.

        Only time I actually need react/vue is when I have to frequently mutate/delete in the DOM.

        But if I purely am additive, adding things to the DOM, template elements are plenty.

        • araozu@lemm.ee
          link
          fedilink
          arrow-up
          2
          ·
          11 months ago

          Could you elaborate on the htmx security holes? I only know about xss attacks, and for those it’s trivial to sanitize in the backend.

          I too gravitate towards just templating for static or simple interactivity, but for pages that need SEO and interactivity I’m still wondering what’s a good solution that doesn’t involve SSR and a js framework. For a recent project I had I generated the html in php and sent a lot of pure js for dom manipulation

          • pixxelkick@lemmy.world
            link
            fedilink
            arrow-up
            8
            ·
            11 months ago

            Htmx has a bunch of logic that basically completely bypasses Content Security Policy stuff, as it has its own pseudo baked in “execute inline js” logic that executes arbitrary javascript via attributes on html elements.

            Since this gets executed by the HTMX logic you load in from their library, it effectively allows an attacker to arbitrarily execute js via manipulating the DOM, and Content Security Policy won’t pick it up because HTMX parses the attribute and executes on behalf of it (and you have already whitelisted HTMX in your CSP for it to function)

            Result: It punctures a giant hole in your CSP, rendering it useless.

            There’s technically a flag you can flip to disable this functionality, but its via the dom so… not reliable imo. If I could pre-compile HTMX ahead of time with that functionality completely disabled to the degree it doesnt even get compiled into the output .js at all, then I would trust it.

            But the fact all the logic is still technically there in the library I have loaded and I am purely relying on “this flag in the dom should block this from working, probably”, I don’t see that as very secure.

            So until that gets fixed and I can compile htmx with webpack or vite in order to completely treeshake that functionality right the hell out of my output, I aint gonna recommend anyone use it if they want an iota of security on their site. It’s got literally baked in security bypasses, don’t use it.

            Hell Id even just be happy if they released a “htmx-lite” package I could use, that just doesnt have that functionality baked in, thatd be enough to make me consider it.

  • XTL@sopuli.xyz
    link
    fedilink
    arrow-up
    61
    arrow-down
    3
    ·
    11 months ago

    PHP isn’t dead. It’s just smelled that way for decades.

  • breakfastburrito@sh.itjust.works
    link
    fedilink
    arrow-up
    45
    arrow-down
    2
    ·
    edit-2
    11 months ago

    This was nearly a decade ago. I worked at a small app company (5-10 developers) for a bit that used Ruby on Rails for our product. The product was in active development, but was available to customers so it was “done”. We were hiring a senior level dev to oversee the team and we interviewed this guy (maybe in his 40s?, a but older than most people in tech) and he said his first order of business if hired would be to refactor the entire code base to php. I don’t think he was joking. I’m not sure why he interviewed.

    • TCB13@lemmy.world
      link
      fedilink
      English
      arrow-up
      10
      arrow-down
      3
      ·
      11 months ago

      Is there anything serious still running on a Ruby codebase nowadays? In PHP however…

      • antimidas@sopuli.xyz
        link
        fedilink
        arrow-up
        9
        ·
        11 months ago

        GitLab is Ruby at least, I don’t immediately remember any others but there probably are some

          • TCB13@lemmy.world
            link
            fedilink
            English
            arrow-up
            2
            ·
            11 months ago

            What can they do tho?

            Since the beginning, GitHub.com has been a Ruby on Rails monolith. Today, the application is nearly two million lines of code and more than 1,000 engineers collaborate on it daily

      • darkpanda@lemmy.ca
        link
        fedilink
        arrow-up
        8
        arrow-down
        1
        ·
        11 months ago
        • GitHub
        • Gitlab
        • Airbnb
        • Shopify
        • Hulu
        • Zendesk
        • Basecamp, obviously

        I know of a bunch of less famous ones, but those are a few of the bigger ones that I’m aware of.

      • kroy@lemmy.world
        link
        fedilink
        English
        arrow-up
        4
        ·
        11 months ago

        Only people supporting legacy regret.

        Ruby was never good. It just got memed enough to make it way into some medium business

  • Arthur Besse@lemmy.ml
    link
    fedilink
    arrow-up
    42
    ·
    edit-2
    11 months ago

    This is an irritating meme.

    Were people saying PHP was dead in 1995, the year it was released? I guess maybe?

    But who was suggesting abandoning PHP for Django in 2003, two years before the latter was publicly released? I suppose the person who made this must’ve read that Django development started in 2003 and gone with that; most of these years correspond with when the respective project started.

    So, the reason Perl (which remained more popular for web development than PHP or any of these things into the early 2000s) isn’t on the list must be because it actually predates PHP.

    But then what is up with Python in 2022?

    • paholg@lemm.ee
      link
      fedilink
      English
      arrow-up
      30
      ·
      11 months ago

      I also appreciate that you’re supposed to learn Django 19 years before you learn Python.

    • catacomb@beehaw.org
      link
      fedilink
      English
      arrow-up
      1
      ·
      11 months ago

      Yeah, plus PHP was very popular circa 2011-2016 and laravel was loved by many around that time and beyond. It’s always been a useful language.

  • thisfro@slrpnk.net
    link
    fedilink
    arrow-up
    36
    ·
    11 months ago

    I’m sure there are a lot of reasons why PHP is better than Python for the backend, but I created an app wirh Symfony 5 and then an app with Django 4.

    Symfony is so weird compared to Django. With Django I can just sit down and get things done. Symfony always seems to have some quirks which are mostly due to PHP (and me not knowing how to program in PHP).

    That said, PHP hosting is so much easier and cheaper, this probably is important for smaller projects.

    • SokathHisEyesOpen@lemmy.ml
      link
      fedilink
      English
      arrow-up
      16
      arrow-down
      4
      ·
      11 months ago

      You don’t need a framework for PHP. That’s the beauty of it, you don’t need anything. You cannot build a website with Python without a framework.

    • PlexSheep@feddit.de
      link
      fedilink
      arrow-up
      10
      ·
      11 months ago

      Django is pretty nice, yeah. We also have good compiled webapps, with go and rust. Gitea for example uses go.

    • locuester@lemmy.zip
      link
      fedilink
      English
      arrow-up
      7
      arrow-down
      3
      ·
      11 months ago

      Isn’t all hosting containerized at this point? Is hosted, language specific servers still a thing?

      I’ve been out of the market for a while now and just run everything as containers on aws and gcp

      • thisfro@slrpnk.net
        link
        fedilink
        arrow-up
        1
        ·
        11 months ago

        Many older projects don’t get migrated to containerized infrastructure and smaller businesses don’t want the overhead it creates to run a single app/webpage. Plain LAMP with FTP access is still the most common way to host I think (and thus the cheapest if you consider the amount of work that would need to be invested to containerize).

        • locuester@lemmy.zip
          link
          fedilink
          English
          arrow-up
          1
          ·
          11 months ago

          Interesting. I never really realized how it was more my path changing than the entire industry.

          • thisfro@slrpnk.net
            link
            fedilink
            arrow-up
            2
            ·
            11 months ago

            The industry is surely changing, but “the industry” is mostly geared towards enterprise, because it’s where the money is. But the large amount of webpages are not enterprise pages but personal blogs, small businesses etc.

    • TCB13@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      5
      ·
      11 months ago

      Lets just say that Python was a language that was never supposed to be used for anything production related. PHP’s memory management and multi threading capabilities are WAY more solid and less prone to leaks than Python 's.

      • kroy@lemmy.world
        link
        fedilink
        English
        arrow-up
        3
        ·
        11 months ago

        As someone that used PHP professionally for literal decades, the PHP hate is so meme-y.

        Its biggest problem is that it allows you to do some truly cursed things. The same can be said about other languages, but PHP really doesn’t do much to set you up for success, especially as a new-intermediate coder.

        With opcache, it became fast enough for basically most web backends, and as a language overall it does seem to be evolving and shedding off some of the crap that used to make it truly horrible in the hands of a new person. At least the type-juggling stupiderrors

        Now I mainly use go and python (only because I have to on this one), and I would put Python and PHP on a similar level of “fuck this language” moments

    • zeppo@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      13
      ·
      11 months ago

      For the backend? Why? I could see PHP being better for the front end considering it’s basically a templating language already, and setting up Python on a webserver is much more complex, last I tried.

      • SokathHisEyesOpen@lemmy.ml
        link
        fedilink
        English
        arrow-up
        16
        arrow-down
        2
        ·
        11 months ago

        PHP is a server-side language, how do you plan to use it for the front-end? Good luck with that!

        • zeppo@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          arrow-down
          4
          ·
          edit-2
          11 months ago

          Oh, I see what you mean. I thought you meant output HTML and templating vs server side logic, but yes, obviously I know the difference as the only front-end language is JavaScript and derivatives.

          I’m more used to the terms ‘server-side’ and ‘client-side’ btw. Obviously PHP is server-side. But not all server-side is backend in my view. I consider backend to be application logic and things like database access. Templating can be done on the server or the client, and that’s front-end.

  • effward@lemmy.world
    link
    fedilink
    English
    arrow-up
    34
    ·
    11 months ago

    I like how 3 of them, across almost 20 years, boil down to “learn Python”. When’s that dude gonna die??

  • Einar@lemm.ee
    link
    fedilink
    arrow-up
    18
    ·
    edit-2
    11 months ago

    Symfony, Laravel & other PHP based frameworks are going strong. PHP isn’t going away anytime soon.

  • nucawysi@lemmy.world
    link
    fedilink
    arrow-up
    14
    ·
    edit-2
    11 months ago

    django and flask are python btw and people wanted to learn python or perl from like 15 years ago, the popularity of python 2 and its “Issues” led to robust dev on python 3, not to mention it being a default for many linux distros since a long time ago