The web server, runtime and application each have a role
A browser or mobile client sends an HTTP request to a server. A web server such as Nginx or Apache accepts the connection and routes applicable requests to the PHP execution environment. In a common deployment, PHP-FPM manages PHP worker processes using FastCGI. PHP-FPM is a deployment component, not a feature that every PHP hosting arrangement must use. Other server interfaces and runtime arrangements exist.
The application then reads request information, identifies the requested operation, validates inputs, applies business rules and may query a database or call an external service. It constructs an HTTP response with an appropriate status, headers and body. The web server returns that response to the client. Frameworks can organize this sequence into routing, middleware, controllers and services; PHP alone does not prescribe those layers.


