←back to thread

123 points jonfelsar | 3 comments | | HN request time: 0s | source
Show context
dingdingdang ◴[] No.45189044[source]
The point made in the article:

* resource leaks are non-existent

Can not be emphasized enough imo. The amount of absolute ridiculous levels of pain instigated by expecting a core code loop to run -forever- and doing so well while being written for some web project or other is just too much to fathom. Just use PHP and serve the request. Then let it die. Then serve a new request.

replies(7): >>45189095 #>>45189147 #>>45189280 #>>45189375 #>>45189453 #>>45189777 #>>45194297 #
ksenzee ◴[] No.45189095[source]
This is, indeed, my favorite feature of the language.
replies(1): >>45189251 #
nine_k ◴[] No.45189251[source]
It's not a language feature but a runtime feature. There's no reason why JS or Python or Java could not be run like that.
replies(1): >>45189288 #
ksenzee ◴[] No.45189288[source]
The language itself, though, does absolutely have this assumption built in. If you want to run it in an endless loop, you’ll have issues.
replies(1): >>45189702 #
1. EGreg ◴[] No.45189702[source]
No you won’t, other runtimes like Swoole, FrankenPHP, and even amphp let you do that, just spin up a PHP process.

I wouldn’t recommend them, though.

replies(2): >>45189996 #>>45195465 #
2. ksenzee ◴[] No.45189996[source]
“You’ll have issues” was my way of saying “I wouldn’t recommend them.” IMO if you want to run in a loop, pick a language where that’s the standard practice.
3. dingdingdang ◴[] No.45195465[source]
I find some of the language around FrankenPHP difficult to parse - is FrankenPHP always in loop mode (ala ReactPHP) or is it simply an option? I can't tell.. my gut reaction upon reading the intro material is that they "simply" replaced Apache/Nginx with Go's inbuilt, and much lighter, server structure and that PHP itself is left to run completely isolated as per usual?!

edit: indeed https://frankenphp.dev/docs/classic/ indicates normal runner capability similar to Apache.