5 ms·
I don't really understand the reasons for using PHP outside of that people are already familiar with it and like working with it or want to find jobs in that ar
by cupcake-unicorn 5y ago
I don't really understand the reasons for using PHP outside of that people are already familiar with it and like working with it or want to find jobs in that area.
If someone is new to software development and in an area of the world where it's not mostly PHP shops, so bigger cities, I don't really understand the benefit.
PHP is often used to do certain things or it may be faster for you to whip something up in Laravel but if you had someone who was a complete blank slate and could chose any language and any framework in a town that doesn't have PHP jobs...why? What's the reason then?
I really think these articles come off really strange like they're trying to convince me as a "fact" but are really just nostalgia, like someone who goes off about how "cars were built so much better back in the day, there's still uses for older cars!" Maybe there is a grain of truth there and some real reasons behind it (repairability) but for 95% of use cases it's just that there's no contest, for a new driver, in an average situation there's no benefit towards going to an older car, and the guy going on about "older cars are the best", while they may have some weird reason that does actually apply to them (and as far as this analogy goes, I think Fortran is a better example than PHP in this case than PHP as for some maths applications it apparently still has an edge but that could have changed) honestly it's just nostalgia/trying to indoctrinate people...
- skinnyarms 5y agoIf you like PHP, great. Do you plan on creating a start-up that you intend to scale to a babillion customers? That you intend to hire teams of developers for? Probably not a good idea. Are you a new programmer trying to figure out which language to learn first? Absolutely not. Python, Java, JavaScript, C# are much more flexible if nothing else. Anybody who tries to convince new programmers to learn PHP is doing them a great disservice.
- heurisko 5y ago> Anybody who tries to convince new programmers to learn PHP is doing them a great disservice. It depends what location you're in. In Europe there are pockets where PHP is very popular, where learning it can open up the job market.
- oaiey 5y agoExcept Facebook literally did that :) But I agree with you.
- jraph 5y agoWikipedia too. And probably many WordPress websites with a lot of traffic. If anything, PHP has proven it works in this regard.
- skinnyarms 5y agoFacebook and Wikipedia were both founded ~20 years ago, think they would make that same decision today? PHP works, but imho starting a new company or career with PHP is a mistake.
- jraph 5y agoI don't know, why not? Why would it be a mistake? On the one hand I have a few examples of huge, successful projects written in PHP and I know they are still around 20 years later and haven't been rewritten in another language. I use projects in PHP on a daily basis (Nextcloud, Rainloop, Wordpress) that work well and have been maintained for years. On the other hand I have a few comments calling out PHP without convincing arguments. Something is wrong. I practice Python and Javascript daily, I've written PHP code 10 years ago, still use some of my code. I occasionally update PHP code on a website I manage. I've seen good things in the new versions. Should I begin a new project today, I would not rule out PHP that fast. I like Python and Typescript, but PHP projects are often a breeze to install (unzip, done) and survive system upgrades and reboots easily as long as php-fpm runs. Projects in other languages need more babysitting. I know, I also use web software in other languages, including one I author. PHP is dead simple to write too. I would probably go for nodejs for something that requires Websockets or SSEs (or a compiled language). Otherwise, I'd seriously consider PHP because it does not require setting up something like uwsgi or celery, write reverse proxy rules, write init service files or running Docker. Put the files in www and it's done. Also no code for managing routes, the file system organization does this for me. No memory leaks, everything is thrown at the end of each request. The architecture is robust.
- arcturus17 5y ago> Do you plan on creating a start-up that you intend to scale to a babillion customers? Not interested in PHP in the slightest, but how is this myth still going around? Wikipedia, Pornhub, Facebook (initially at least) were all built on PHP. There are hundreds of other examples. Laravel nowadays has an outstanding reputation and I doubt it's performance is lagging so far behind Django for example. More generally, after all these years I still need to see a story of a startup that failed because they chose the wrong stack. There are some blog posts with spurious claims in this sense, but really, when has a startup with good product-market fit and a finely designed product ever failed because they chose PHP instead of something else?
- skinnyarms 5y agoThose startups you mention are 15+ years old, would they still choose PHP today? Maybe you haven't heard of startups failing because of choosing the wrong stack, but I'll wager you don't hear about most startups failing because...why would you? Also, have you heard of startups re-platforming? Either because the current stack is falling apart or the company is acquired by a bigger fish and they need to integrate with other services so parts end up getting rewritten to Java/C#. The fact is PHP is good for making websites, and that's all you'd really want to do with it. There are other languages that are good at making websites and they are more popular and have other benefits. If you are building things with PHP and it's working for you, then awesome. But seriously, why encourage it?
- user3939382 5y agoHow is PHP 8.1 an “older car”? Have you looked at the language and runtime recently? I hear stuff like this from people whose latest PHP knowledge is based on that ancient fractal of bad design article.
- jeltz 5y agoYes, I have. I recently programmed PHP after 10+ year break from it and while some things were fixed many of my old issues with it remained. I would not recommend PHP to anyone unless they have an existing code base in it.
- hakfoo 5y agoI think there's value in a large, established ecosystem. Languages tend to go through a few years of flavour-of-the-week fads (think of the Vue/React/Angular competition, and all the also-rans that we can't remember now). If you get in too early, there's a fair chance you'll bet on the wrong ecosystem, and end up with unsupported dependencies or difficult to maintain code. In the worst case, you scrap the whole thing in six months and write it for a new framework to keep it alive. PHP went through that phase back when "we've got to support IE6 users" was a legitimate talking point. You can be reasonably confident Wordpress or Laravel are here to stay. PHP is also fundamentally a hugely battle-tested platform. It's been ran on 486s in the broom closet, and entire rack clusters in data centres. If you have some performance or usability problem, there's a good chance someone else has had it already and worked out a solution. With some new language, your odds of "never seen that before" errors are much higher.
- hiddencost 5y agojQuery changed my life. These days I write server code in C++ :(
- lpcvoid 5y agoWhy so sad, that sounds like a huge improvement over webdev. Modern C++ is a joy to work with.
- selfhoster11 5y agoA very pragmatic reason exists: deployment is dead simple for users with very little technical skill. Deploying PHP software is as easy as subscribing to a shared web host (expensive or not, but most will make your life easy), connecting using FTP/SFTP, and extracting a ZIP file into the main directory. Some hosts even skip the last couple of steps and let you apply a template with a well-known PHP CMS to get you started. Hey presto, you have a functioning web shop, business website, charity home page, or whatever other thing you want. There's a (PHP) app for that. In comparison, other programming languages are hard to figure out. Python, Ruby, Java etc all need some kind of a package manager to install dependencies (PHP apps are self-contained) and need to have the correct runtime version installed (PHP just needs to be in the general neighborhood of what's required, since most broadly used packages seem to be written in a backwards compatible fashion). This is scary and unfamiliar, and highly technical. If you're deploying on a VPS (because rarely anyone has managed Python/Ruby/Java hosting services), you've now also become the sysadmin with full responsibility for the box, including patching and downtime. Compared with shared PHP hosting, it's bonkers.
- joelbluminator 5y ago> Hey presto, you have a functioning web shop, business website, charity home page, or whatever other thing you want. If we're talking about simple templates to open a store or a simple landing page there are so many no-code options like Wix/Shopify/SquareSpace/Square that I don't think PHP offers any significant advantage.
- heurisko 5y ago> I don't really understand the reasons for using PHP outside of that people are already familiar with it and like working with it or want to find jobs in that area. I look at it this way sometimes: there are the interpreted languages, the VM-based languages and then systems languages. PHP is a good option in the "interpreted" languages category, if your problem domain is web-based, as it includes a lot of built in functionality for web-based problems. It's also open-source, reasonably performant, has an improved type system, has a C-like syntax and enjoys features inherent to a scripting language e.g. fast startup time, so would be a good option for lambdas. Finally, one of the features that has been unreasonably good about PHP is the shared-nothing request model, which makes running a website on PHP a stable experience, in an imperfect world of weird state issues and libraries that might sometimes have a bug that leaks memory. There are also other options in the "interpreted" category which I would fully expect people to also look into, however that's not to say PHP isn't a good contender for this space, given learning time is a limited resource. However I would expect people to know a VM-based language and a systems-based language (or at least a bit of one) in addition.
- rambambram 5y agoNot a completely fair comparison. Then at least also tell readers that the 'old cars' you talk about are not in the museum or on the junkyard, but make up half of all the active cars on the road. That's not nostalgia.
- nicoburns 5y ago> If someone is new to software development and in an area of the world where it's not mostly PHP shops, so bigger cities In Europe there is a lot of PHP. Even in the bigger cities. And as someone who knows a lot of different programming languages, modern PHP with Laravel is pretty hard to compete with on a productivity basis.