Here are the very simplified steps:
- The web server recieves a request.
- It checks the resource requested.
- It tries to find the resource as per its configuration. Part of this configuration is that all requests that match the pattern
*.php
should be sent to the PHP interpreter. - The webserver passes the request to the PHP interpreter (which is a module configured for the webserver, or a separate binary, depending on how the web server is configured).
- The PHP interpreter reads the request, then executes the file by interpreting it top to bottom, line by line.
- The results are sent back to the web server, which passes the results to the browser.