←back to thread

133 points avan1 | 8 comments | | HN request time: 0.813s | source | bottom
1. dakiol ◴[] No.45077990[source]
The one thing I don't like about PHP is that the whole application is bootstraped (and autoloading and the configuration is re-evaluated) in every single http request. Sure thing there's cache and all, but it just doesn't feel right (compared, to, for instance, an http server written in golang)
replies(5): >>45078039 #>>45078202 #>>45078278 #>>45079157 #>>45079955 #
2. klaussilveira ◴[] No.45078039[source]
There are well documented and production-ready libraries that you can use to run your own servers with PHP alone, no need for fpm or mod_php. PHP's JIT is pretty impressive and you would be blown away by the results.

https://reactphp.org/

https://www.php.net/manual/en/book.ev.php

https://bitbucket.org/osmanov/pecl-event

https://www.workerman.net/

3. duskwuff ◴[] No.45078202[source]
It doesn't have to be. Some PHP runtimes allow an application to run in a mode where a single script execution processes multiple HTTP requests:

https://frankenphp.dev/docs/worker/

4. mhsdef ◴[] No.45078278[source]
This is one of the things I do like about PHP.

Intrinsically minimized state (to a certain degree).

5. PetahNZ ◴[] No.45079157[source]
This is one of the best things about PHP IMO. It makes it very easy to scale out.
replies(2): >>45080624 #>>45085892 #
6. creatonez ◴[] No.45079955[source]
You're right. It's a completely asinine approach. Especially when PHP itself is used as a templating language.

And solutions that try to fix this (custom templating engines, runtimes that run the whole thing inside a continuous PHP process) are simply putting lipstick on a pig.

The solution is to use a language that wasn't originally called "Personal HomePage"

7. bornfreddy ◴[] No.45080624[source]
Yup. No shared state by default.
8. const_cast ◴[] No.45085892[source]
It also makes it much easier to debug and forces the complexity down.