A PHP worker is responsible for processing dynamic requests on a server when a page cannot be served from cache. It executes PHP code, communicates with the database, and generates the final HTML response sent to the visitor’s browser.
Table of Contents
Request flow in a cacheless environment
When a visitor opens a page, the request follows this sequence:
1. Request reaches the web server
The web server (such as LiteSpeed, Nginx, or Apache) receives the incoming request from the browser.
2. Request is passed to PHP
The web server forwards the request to PHP, where a PHP worker is assigned to handle it.
3. PHP processes the application
This is the most resource-intensive step.
PHP typically:
- queries the MySQL database
- executes application logic (for example WordPress core and plugins)
- loads theme templates
- builds the final HTML output
4. HTML is returned to the server
Once processing is complete, PHP sends the generated HTML back to the web server.
5. Response is delivered to the visitor
The web server returns the final page to the browser.
Why PHP processing matters most
The third step (PHP execution and database queries) is the most resource-heavy part of the process. It consumes:
- CPU resources
- memory (RAM)
- PHP worker availability
Performance impact
Optimized websites
A well-optimized website:
- performs fewer database queries
- uses efficient PHP code
- completes execution quickly
- frees PHP workers faster
Poorly optimized websites
A poorly optimized website:
- performs excessive database queries
- runs heavy or inefficient plugins
- keeps PHP workers busy longer
- creates request queues and delays
Practical implications
- PHP workers are tied directly to how long step 3 takes
- longer execution time reduces concurrency capacity
- caching reduces the need to execute PHP at all
- optimization improves both speed and scalability
Summary
A PHP worker handles the full lifecycle of a dynamic request: receiving it from the web server, executing PHP code, querying the database, generating HTML, and returning the response. Performance depends mainly on how efficiently the PHP and database processing stage is executed.