Live data from Hacker News

PHP 8: Before and After

stitcher.io

241–250 of 346 posts

Re: PHP 8: Before and After

#241
post #235

PHP is a perfect language for webdev and automation: much faster and lightweight than python, good package ecosystem. I do all my process automation tasks in PHP and it's been such a pleasure.

It's situations like that where I'd like a way to write And dump some python code the same what you'd do php and have my web server serve it up. It would be handy, but I'm sure the uses cases are limited.

If you are sufficiently motivated, you might look into Emac's "babel" scripts, which can run Python embedded in org-mode files. You could use mod_wsgi in Apache to set your .pml (Python Markup Language, I just made that up) files to be parsed.

Re: PHP 8: Before and After

#242

Earlier quoted context omitted.

I tried searching for "refactoring legacy code" but I couldn't find it. Who's the author?

Sorry, I misremembered: "Working Effectively with Legacy Code" is the name. The author is Michael C. Feathers I think.

There seems to be a new version coming out in the next couple of months (ISBN 9780136657125) but I can't tell if it's a new edition or just a redesign.

Re: PHP 8: Before and After

#243

Earlier quoted context omitted.

Are you productive in any of the following? C#, Ruby, Rust, Elixir, Typescript (or even Haskell) If not, you're just proving my original point. It's hard to see the problems of a language if you are only productive in that language. I can start pointing out flaws in PHP, and you can claim that those flaws don't matter. Until you increase the number of languages in your repertoire, our discussion about the flaws of PH…

I think arguments against PHP could be make against many other languages, ie: Javascript or python. But they are not done as much and I think this indicates that people make those arguments in bad faith. If we say once a better language comes along, we should say that the old language is shit and should die, then sure keep doing that. But looking at the languages that you have listed above, none of them are dynamical…

Are you productive in any other language than PHP?

Re: PHP 8: Before and After

#244

I'm just going to come out and say it, and say it proudly ! 1) I love coding in PHP (I am a cs major) 2) I love riding scooters. There - internet be damned !

Not a CS major, but PHP has been my preferred language for web stuff the last 20 years. Even way back it was just so damn easy to work with.

Sure, I'll look to Go, Ruby, Crystal, Elixir and others for more specialized stuff, but plain and simple CRUD web stuff is what PHP is made for.

Re: PHP 8: Before and After

#245
post #222

I don't really understand why in 2020 there's still this kind of blind hatred against this language. It often comes from horrible bad memories from previous versions or old frameworks. Objectively, compared to other languages i've been working with it is more than OK. Despite it's lack of "style" it is easy to understand, host, tests, diagnose and it is powerfull for web applications. I've been working on a SaaS API…

> I don't really understand why in 2020 there's still this kind of blind hatred against this language. I don't either, but what I also don't understand is why in 2020 anyone would use PHP over many available vastly superior alternatives. Other than keeping old stuff running, why do people keep beating this dead horse? I just don't get it.

Perhaps some developers who already know PHP want to get on with building things instead spending time comparing language penis lengths?

Re: PHP 8: Before and After

#246

Can a fellow geek knowledgeable in PHP gives me a few pointers? I have inherited a 12 year old PHP app written by 2 interns. The code was written with Notepad++ (no IDE), no comments except when they copy pasted something from the internet, most variables are single letter and it's the biggest spaghetti bowl I have ever seen. To add insult to injury I have no experience with PHP (apart from peeking at this code to fi…

> Is there a way for me to have an IDE with a kind of "compiler" that would help me convert this to PHP 8 so I can migrate it on a more recent VM? Of course there's 0 budget for this. There is your problem. If it's runs on PHP5 (<?php phpinfo(); // in a php page), it might run without hurdle on more recent versions of PHP... or not, but PHP8 isn't a different language, they just added some stuff on top of PHP5. C ext…

> PHP8 isn't a different language, they just added some stuff on top of PHP5.

there were some backwards-incompatible syntax changes between PHP 5 and 7 though. a client once switched on PHP 7 on his ancient WP website and it stopped working altogether because it used some weird no-longer-supported form of `new Foo`.

Re: PHP 8: Before and After

#247
While I used drupal heavily then switched to wordpress for all sites I do, I'm now using golang instead.

PHP is good at what it does, but its usage is in decline over recent two decades, actually, if without wordpress's installation, its relevance might be very very limited if anything at all these days.

Re: PHP 8: Before and After

#248

Earlier quoted context omitted.

I think arguments against PHP could be make against many other languages, ie: Javascript or python. But they are not done as much and I think this indicates that people make those arguments in bad faith. If we say once a better language comes along, we should say that the old language is shit and should die, then sure keep doing that. But looking at the languages that you have listed above, none of them are dynamical…

Are you productive in any other language than PHP?

Alright, if that's the filter people need to pass before you listen to their arguments then I'll tell you the list of languages I am productive in:

Javascript, PHP, Haskell, Rust, C++ and LISP. I'm familiar with the benefits and drawbacks of all of them and I don't see how any of them replaces PHP

Re: PHP 8: Before and After

#249

I don't really understand why in 2020 there's still this kind of blind hatred against this language. It often comes from horrible bad memories from previous versions or old frameworks. Objectively, compared to other languages i've been working with it is more than OK. Despite it's lack of "style" it is easy to understand, host, tests, diagnose and it is powerfull for web applications. I've been working on a SaaS API…

I haven't found any good arguments against PHP in the comments here, just pure hate. Let's name a few of the arguments people are making: 1. Its variables start with $ and that is ugly: I mean, come on, I won't even entertain this bigotry. 2. It used to be better before: This is just pure nonesense, before OOP PHP wasn't good to create any big and well-structured application, it is ironic because most of the bad opin…

I have my reasons to _despise_ hosting PHP from an operational perspective. These mostly come from having to host ready-made PHP applications like Nextcloud, Wordpress, Dokuwiki, etc.

1) 'Language configuration' kept in a php.ini that is usually not shipped with any project. Instead, each project tells you what flags to flip so that it runs, but very often every distribution ships PHP with slightly different flags, effectively making it _very_ hard to have a 100% correct php.ini.

2) 'Deployment configuration' that is additionally present in your FPM/apache configuaration. Again, you have to be told by a project that that these given options (often related to timeouts and request size) have to be set. Many projects just assume you have some 'sane defaults' like things bumped up from the defaults. Again, very difficult to get reproducible deployments of an app, unless the developers are very insistent on documenting everything.

3) Extremely painful to debug. If 1) or 2) are broken and a connection terminates during an upload with some 400 error, the error can be in multiple places: nginx/apache, php-fpm, or the PHP code itself. Each one of them logs to a different place, or not at all. It's difficult to actually understand the _source_ of the error. Good luck. Bring strace.

4) Broken upload model. If I understand correctly, all file uploads in PHP must end up on the local filesystem, and they are impossible to directly stream onto something like S3. This means that my Nextcloud instance will first save a few gigs of data on /tmp, and then only punt it over to S3. Gross.

5) Annoying to host in containerized environments. Both Apache and nginx are the kind of applications that insist on doing a bunch of setuid()s, thereby breaking on hardened containerized environments. Not to mention having to host a nginx+fpm/apache combo per application just seems wasteful, but there's no other easy way to deploy PHP apps in a containerized way that I'm aware of.

6) Configuration woes with rewrites, static files, etc. This is related to 2), in which you have to spend a bunch of time configuring your HTTP server in order to split up requests between static file serving and PHP, set up rewrites, and hope you don't accidentally introduce a security vulnerability.

All in all, compares to something like 'here's a go binary, run it, push HTTP traffic to it, it will serve its own static files, too', PHP is an _extreme_ pain in the ass to host.

Re: PHP 8: Before and After

#250

Earlier quoted context omitted.

I haven't found any good arguments against PHP in the comments here, just pure hate. Let's name a few of the arguments people are making: 1. Its variables start with $ and that is ugly: I mean, come on, I won't even entertain this bigotry. 2. It used to be better before: This is just pure nonesense, before OOP PHP wasn't good to create any big and well-structured application, it is ironic because most of the bad opin…

>I won't even entertain this bigotry. I'm not sure using a word that has historically been used for people who are racist is the right word when talking about programming languages.

You might want to look up the definition of "bigotry" then...
Post reply on HN