3 ms·
> When I read comments like this I always wonder who is out there creating stateful HTTP applications? As a benefit of PHP this isn't a new thing, and usually
by kcartlidge 5y ago
> When I read comments like this I always wonder who is out there creating stateful HTTP applications?
As a benefit of PHP this isn't a new thing, and usually what is meant isn't that people are deliberately creating stateful HTTP applications (thought they may be!).
What it normally refers to is the way that with PHP every request gets a totally new instance of the interpreter to run in, as it is basically started up from scratch to service that one request, does it's work, then disappears again. There is no possibility of bleed across requests or of accidental shared state.
Whereas with Node, Go, C# etc, there is (by default) a long-lived 'server' process that handles all incoming requests and so doesn't have that automatic request segregation but instead relies on code (framework and/or application).
To rephrase, with PHP there are multiple requests each of which get their own one-shot instance to run in (guaranteeing segregation). With most alternatives there is one server instance which handles multiple requests and something in the stack somewhere has to manage that segregation.
PHP maps many requests to many servers. Versus many requests to one server. But of course this is all very much a simplification.