PHP Child / A Request And Its Life

The short life of a single request

From arrival to reply is a small, complete story that repeats endlessly.

A request arrives as a short message: I would like this thing, here is who I appear to be, here is what I can accept. The machine reads it and works out what was actually being asked for, which is rarely as obvious as the address suggests. It then decides whether the request is permitted at all. Only then does it begin gathering: stored records, saved copies of earlier work, values calculated on the spot. Those pieces are arranged into a finished reply, the reply is sent, and the episode closes.

The closing matters as much as the rest. When the reply has gone, the working memory used to build it is released. Anything the machine wants to remember must have been written down deliberately, somewhere designed to outlive the request. Everything else evaporates. This is why the next request begins from nothing and why remembering a visitor is a separate problem with its own machinery, rather than something that happens naturally.

Seen this way, a busy site is not one long-running program. It is an enormous number of short, independent stories, most of them lasting a fraction of a second, many of them running at the same moment, none of them aware of the others. Almost every unusual behaviour a beginner meets later, from a stale figure on a dashboard to two visitors somehow interfering with each other, becomes easier to reason about once that picture is fixed.