Live data from Hacker News

PHP is worth learning and using

bulletproofphp.dev

451–460 of 468 posts

Re: PHP is worth learning and using

#451
post #406

Earlier quoted context omitted.

Facebook 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.

I 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 convi…

Couple reasons:

* It's waning in popularity, new programmers aren't being taught and there isn't a lot of incentive for them to seek it out * Other languages are also good at making websites but many are more popular and more flexible - machine learning, video games, front-end web development, enterprise services (and sure PHP can be "enterprise" but many new cloud/apache projects are java first)

So yeah, I'm not saying PHP is dead...just that it's not a good investment for new developers and it's questionable for new projects.

Re: PHP is worth learning and using

#452
post #344

Earlier quoted context omitted.

Yep, almost 20 years ago and it's been both a technical and hiring problem for them ever since.

Is there any large tech company without technical and hiring problems?

Why make it worse by choosing backend-only web languages with bad reputations?

Re: PHP is worth learning and using

#453
post #315

Earlier quoted context omitted.

So does ex. heroku for all the other languages, and that actually scales. As well as most shared hosters offering node and rails. Don't get me wrong, my whole point is that this 'simplicity' is given in any ecosystem these days. Except live coding via FTP is something you consider part of the simplicity, then you are stuck with PHP :)

This is not accurate. While some shared hosts offer node or rails you will be limited by memory and it might not even run your app. The reason PHP is so good for shared hosting is that it runs per request and when you have rarely visited PHP application it requires basically no resources. You can have 100s of small websites sharing resources that get few visitors a day on single server and it will be fine. Try doing…

I was just using generic examples.

However the way rails apps works with phusion passenger is exactly what you are explaining. I can run hundreds of apps next to each other on a tiny VM. Once a app is loaded I don't have to rebuild the state on each request, if it is not needed anymore (or rather another app needs the resources more) it gets unloaded again.

Setting up passenger, nginx and git for pushing is also a job of 10 minutes max.

I get there is a market for PHP, I too recommend wordpress when I don't want to code something for someone. I just don't see it's 'simplicity' as argument.

Re: PHP is worth learning and using

#454

Earlier quoted context omitted.

That ship has sailed a long time ago (or you're just playing around and most languages will have a REPL nowadays) Modern PHP wears a business suit and wants to buddy the "big boys" (Java/C#) of the world. You'll have deployment pipelines, strong push towards classic OOP, strict type checking etc. I personally think ruby for instance is leaner in its dev process in most real world projects.

Many people learn PHP as a first or at least as an early language. They don't want to know about deployment pipelines, CI/CD, or how to configure JDBC, they want to make a website store a list of names. You can't easily generate HTML from Java without some kind of templating language and framework around it, or a billion string concatenations if you're working without external libraries. ASP.NET has an advantage simi…

My issue with your approach is your first time programer still needs to:

- install/update PHP or go with the outdated version that shipped with their system.

- have a hosting service that will accept random PHP files

- know what their hosting's PHP version/configuration is to match it locally. For instance their hosting will keep the most secure config possible, thus no out of the box fetching of URLs.

- endlessly fight to find syntax errors as they are too new to have a linter. Depending on the PHP version they settled on they won't have error logs in one place but two.

- fight the endless stream of out of date tips and tricks left by 2 decades of PHP programers of various pedigree.

All of these have different variations for different languages, they all have their barriers and dead bodies in the closet. My take is that PHP isn't specially beginner friendly at this point, at least not as friendly as it was when it began.

Making a public website from scratch will be complex anyway, so they might as well go with a saner setup that uses a templating language and not write code right into the HTML. It won't be much harder and they'll have a fighting chance to find up to date tutorial to host their project easily (hosting a rails project on Heroku for instance could be miles easier in that respect)

Re: PHP is worth learning and using

#455

Earlier quoted context omitted.

One person’s complexity is another person’s valuable job skill. PHP and Apache aren’t hard to setup and configure if you know how it works.

I completely agree that being able to navigate an ecosystem's complexity is a skill. I didn't mean to imply that other languages don't have complexities. All ecosystems come with their own boons and complexity issues (hidden or upfront). The thing I wanted to address is the general idea of "PHP is the simplest to develop in, it's just uploading a file" (paraphrasing) shouldn't be taken at face value, and that's why I…

With a hosting provider that already has PHP installed, you can simply upload a file to a folder and serve it over the web with no special expertise.

PHP makes it easy for beginners and amateur programmers to get something working without knowing much.

Because of the low-barrier to entry and simple hosting setup people have written a lot of crap PHP code over the years. I know, I see it and work with it.

Amateurs and well-meaning power-users can get some web pages up and running easier with PHP than with almost anything else, so while inexperienced programmers can write bad code in any language a large number of them choose PHP.

None of those facts mean PHP is not suitable for "real" development and "real" programmers. It is not obsolete or dying. A professional programmer who knows how to build production-quality web sites can get great results from PHP. That requires putting in the same time and effort needed to learn any other language and set of tools.

Re: PHP is worth learning and using

#456
post #83

Earlier quoted context omitted.

> How so? Ruby just released a new version with a JIT and new concurrency model. Rails is releasing a new major version later this year with a bunch of great improvements. Shopify, Stripe and others are putting a ton of improvements into the Ruby interpreter. Do all of these make it faster than PHP?

Is speed the only measure of a programming language? Honestly, I have no idea how it compares to PHP. If I wanted truly fast I'd use a compiled language. The point is more that Ruby is still being used and improved upon all the time; far from 'dead'.

> The point is more that Ruby is still being used and improved upon all the time; far from 'dead'.

Exactly the same with PHP. The handful of Rails devs I know bemoan the fact that fewer shops are growing their Rails/Ruby use. I did a stint at a shop that was mainly PHP, but they migrated most stuff to a combination of node and python, because "they couldn't find php developers". While it was sort of true, they couldn't find affordable php devs to work with the legacy mess (which was only 5-6 years old), and it was cheaper to have less experienced (but more) node/python folks come in and rebuild distinct bits of the older PHP stuff (at least, that was my understanding as an outsider - this happened after I left).

Some orgs are moving away from PHP - others are moving towards it. Same with Ruby, although I don't see as much movement toward Ruby as I do with PHP. But I do also see orgs moving away from each.

Re: PHP is worth learning and using

#457

Earlier quoted context omitted.

Python, JavaScript, Java, C# have all had great longevity, and much more popular, and can do anything that you can do w/ PHP and a whole lot more. Encouraging new programmers to learn PHP is cruel.

Encouraging new programmers to learn Java isn't cruel? "Son, today is the first day of a long journey into enterprise software development. Yay" It is cruel, and something Universities have been doing forever.

You prefer customizing wordpress?

Re: PHP is worth learning and using

#459

To me personally PHP is the cheapest way of building a dynamic website. Just a few euros/dollars a month will get you a shared web hosting plan with full support for the LAMP stack & free email.

That was true in 2004. Today you get a virtual server for five bucks a month. Feel free to run ANY stack you prefer.

Virtual server is great except now you are reponsible for server management, SSL certificates, backups, DB, firewall configuration, mail server, etc. I don't want any of that which brings me to PaaS providers like Heroku and Vercel where the cost is many times higher.

Re: PHP is worth learning and using

#460
post #78

Earlier quoted context omitted.

Why are y'all arguing about this when you already learned like 20% of php by reading the OP. Learning enough of a high level scripting language like php to be able to be useful and productive in it is not some huge time sink, it's a few dozen hours of reading docs and tinkering

Opportunity cost. Those "few dozen hours" reading PHP docs and tinkering could also be used to learn Python, Ruby, or Javascript, each of which are almost certainly better choices with broader applicability and more modern ergonomics. Python gets you web backend + ML, Javascript gets you web backend + web frontend. Ruby gets you a multi-paradigm language with nice ergonomics and cats. PHP gets you job offers customiz…

> PHP gets you job offers customizing Drupal and Wordpress websites

I get that there's a lot of legacy PHP sites, that you could end up finding yourself working on. But there are still plenty of new Drupal and Wordpress sites being built.

You could also say that building a site with these tools as akin to "customising", as a lot of what you're doing is configuration rather than coding (but I would say sometimes JS + NPM is pretty similar). There are still opportunities to push yourself with coding, with some fairly complex Drupal sites being built.

Post reply on HN