Remix.run Logo
dakiol 3 days ago

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)

klaussilveira 2 days ago | parent | next [-]

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/

duskwuff 2 days ago | parent | prev | next [-]

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/

PetahNZ 2 days ago | parent | prev | next [-]

This is one of the best things about PHP IMO. It makes it very easy to scale out.

const_cast 2 days ago | parent | next [-]

It also makes it much easier to debug and forces the complexity down.

bornfreddy 2 days ago | parent | prev [-]

Yup. No shared state by default.

mhsdef 2 days ago | parent | prev | next [-]

This is one of the things I do like about PHP.

Intrinsically minimized state (to a certain degree).

creatonez 2 days ago | parent | prev [-]

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"