News for hackers. Stuff that matters.
Re:PHP is worth learning and using by defanor on Thursday November 18, 2021 @08:02AM (#29264921)
That's not quite a language feature though: one can write (Fast)CGI or similar programs in any common language.
Re:PHP is worth learning and using by chippiewill on Thursday November 18, 2021 @08:27AM (#29265103)
I've never actually tried writing CGI scripts with a non-PHP language (I've not really seen the point since it's usually more ergonomic to just use a language native-server interface like Python's WSGI).

Do any other languages have the same kinds of optimisations that PHP has with FPM where it keeps the process alive but pretends it's a complete fresh execution at the language level? (getting the performance benefits of a persistent process, while having the simplicity of CGI-style execution).

Re:PHP is worth learning and using by tyingq on Thursday November 18, 2021 @08:59AM (#29265420)
>Do any other languages have the same kinds of optimisations that PHP has with FPM where it keeps the process alive but pretends it's a complete fresh execution at the language level?

I know that's how the TCL and Perl FastCGI implementations work. I suspect that's how most of them work, and there's lots of languages supported by FastCGI.

Re:PHP is worth learning and using by defanor on Thursday November 18, 2021 @09:00AM (#29265421)
> Do any other languages have the same kinds of optimisations that PHP has with FPM where it keeps the process alive but pretends it's a complete fresh execution at the language level?

I'm not aware of other languages where it is baked into a language itself, but FastCGI libraries tend to be basically drop-in replacements for CGI ones (at least it's the case with common C, Perl, and Haskell libraries; sometimes CGI and FastCGI libraries are combined, so that they are usable in either setting): you get the optimization, while still can pretend that it's a regular CGI. I guess the primary difference from PHP is just that global/static variables would survive.