Live data from Hacker News

PHP is worth learning and using

bulletproofphp.dev

461–468 of 468 posts

Re: PHP is worth learning and using

#461
post #410

Earlier quoted context omitted.

PHP does have it's own built-in server as well, although it is not really meant for production use. Global PHP configuration options have become less important over time, with resource limits and extensions being most of what has to be configured now.

My bad, I didn't know that about PHP build in server I only host one PHP app now (Nextcloud) and it has definitely been a bit of a pain in comparison with other things I self host.

Nextcloud is more complex than most PHP apps.

Re: PHP is worth learning and using

#462
Nine years ago I decided to use plain old PHP and MySQL to build a self-hosted analytics platform[0], and to this date I still think this was the best decision I could make. Even though nowadays cloud, Docker, Golang, Node.js, Kubernetes are all the rage, most of the websites and hosting providers are still running on PHP/MySQL, which means running the platform can be done on the same server and customers can try it without having to learn to deploy to the "cloud".

Not only this, but PHP/MySQL is such a reproductible stack, if the code is properly written you can run the same app on tens of different server configurations (Windows, Ubuntu, CentOS, various versions of MySQL and PHP) without having to change anything.

[0]: https://www.uxwizz.com/

Re: PHP is worth learning and using

#463
post #13

Earlier quoted context omitted.

> Do you write that site in Go? Yes! https://gohugo.io/ would be a great choice for that kind of thing.

That would likely then require a developer to update the content. Not ideal for a marketing website.

Depends a lot on your set-up. Many pair Hugo with a headless CMS for exactly this reason.

Even with a standard Hugo set-up, most content is in Markdown files, so one could also just train someone from marketing on how to edit those. Not exactly rocket science.

Re: PHP is worth learning and using

#464
post #3

This seems like a desperate attempt to justify not moving on from a language whose death knell rang a long time ago. You might as well try to convince me I should start my next business with cutting edge software written in Fortran or COBOL.

I think the news of PHP's death came a bit too early. Most people I know claimed it was dead during the time Node was getting popular and people started pushing for things like websockets to make updating pages faster. PHP couldn't do that so people said it would die, and honestly if you were in a startup or a FAANG at the time it looked like it would. Everyone was moving from a REST web 2.0 model to a "live, concurr…

That reputation is only viewed that way by a tiny number of nerds, typically with static language backgrounds that don't ship much code or product.

I added more value to a tech agency and their clients with PHP than several of the senior Java guys did combined. And they were talented. Just set in their ways and lacked a focus of getting things done and adding value.

They'd waste time overbuilding shit that nobody used because it was interesting to them, not that it would create value for the client or end-users.

Also, I took over several large Node projects built by hipsters and they are the messiest code bases I've ever seen. And I've inherited a lot of trash PHP ones over the years.

Regarding the concurrency thing with PHP - ReactPHP is very nice, PHP 7 and on performance gains were massive, and real-time (search, chat, etc) can be better handled by Algolia/Pusher/etc anyway.

The Node hype train had a great run. And I still like Node. But PHP is the language of getting shit done.

Re: PHP is worth learning and using

#465

Hey if you don't like PHP please don't use it. I 'd hate to bring the culture of tiny packages, fake compilers, transpilers and weekly trends to PHP. Personally I use php because it works well and fast and still supports my 10 year old websites, not because it's cool.

Php change from 4.x to 5.x broke my web sites and I still don't trust php after that. I guess they might do it again from 7.x to 8.x, we'll see. If having the same code working for a long time is the most important for you then you should probably use java or .net. Maybe c++ also but that is not as popular for building web apps.

I made my homepage in PHP, nothing important, but I spent some time doing it and I liked the result.

Then I didn't have enough time to maintain it, and I stopped paying attention to it for a while.

Later I checked my homepage again, the webhosting company updated the PHP version, nothing works anymore. It is not simple to fix, so I gave up.

I am not going to spend the same amount of effort on making my homepage in PHP again. Trust is easier lost than gained.

I would still be willing to code something in PHP for someone else, because hey, if it stops working in a year or two, it's their problem, not mine. But I would warn them that something like this is possible, and in my opinion likely to happen.

Re: PHP is worth learning and using

#466

PHP is a lot better. But it still has a lot of the same old issues when you look beneath the service. Good luck remembering what all the str* functions they invented do and what order their arguments are in. Same for the array functions (don't get me started on implode's three signatures - but that's mostly fixed in 8!). And may His Noodly Appendages help you if you come across a function being used which has no docu…

The argument order flaw is never going away. BC. It's a super minor thing. The non-documented functions are often rare and very minor and obivous functions. This layering framework on top of frameworks sounds made up. Mostly people either use Symfony or Laravel. There aren't layers of frameworks. Your example is nonsensical. Frameworks are slower than simple code, this is true for every language. And Symfony and Lara…

I am well aware that it is never going away. I wouldn't call it minor, it's an extremely common source of bugs.

The non-documented functions are indeed often rare. That's all that can be said about them. They're about as obvious, on average, as the rest of PHP's functions are obvious.

Sure, until you want to have a UI framework, and an API framework, and ...

LOL @ Laravel being well documented. There's a tutorial and there's autogen API docs. And that's it.

This comment overall seems to be written by someone who has worked with PHP for a few years and thinks he knows everything there is to know about it.

I've been using PHP since PHP3 and professionally since PHP4, but thanks.

Re: PHP is worth learning and using

#467
post #61

I have used PHP for years. Like it. Have accomplished some nice things with it. Think it's evolved nicely in recent years. Feel it's a great tool for particular problems. Will continue to use it. Will always be open to alternatives. Will never understand why some people find that so offensive and will tell you that you mustn't use it or imply that you are ignorant or stupid for using it.

For people of a certain age and job history, the worst code they've ever inherited was written in PHP. I think JS can be worse. There are things that are possible with dynamic languages that are literally impossible with static ones. So think of PHP less as a "bad language" and more of a code smell.

Clearly you've never inherited anything written in Perl.

Re: PHP is worth learning and using

#468
post #397

Earlier quoted context omitted.

I'd be interested to know what you think PHP got wrong with respect to web development? The majority of the web is running on PHP to this day, so at least in terms of popularity it seems people don't feel this way generally. Furthermore, if one were philosophically-minded, it could be argued that PHP's "shared nothing/one thread per page" execution model is the very quintessence of HTTP.

I’m curious what metric you’re using to determine that a majority of the web is running on PHP.

What alternative language do you propose? Not that asking for a source is unreasonable, but you seem to doubt that PHP has majority market share. Do you suppose that Node is more popular? Rails? Go? Flask?
Post reply on HN