April 9, 2011, 3:46 p.m.
posted by romcheg
Requesting Data from a Web Page
How all of these pieces integrate together can be tricky to understand. If a web server detects PHP code, it determines whether the file is a PHP file, and if so, turn over the processing of the page to the PHP interpreter without any additional participation by the web browser. But if you include an external CSS file, your browser issues a separate request for that file before viewing the page.
PHP Interpretation on the Server
This processing of the PHP on the server is called server-side processing. When you request a web page, you trigger a whole chain of events. Figure illustrates this interaction between your computer and the web server (host of the web site).
While the user only types in a URL and hits Enter, there are several steps that occur behind the scenes to handle that request
Here's the breakdown of Figure:
The HTML file called directory.html (requested in Figure) is called a static web page. It is static because everyone who requests the directory.html page gets exactly the same page.
For the web server to customize the returned page, PHP and MySQL are added to the mix. Figure illustrates the extra steps that occur in the chain of events on the web host.
The PHP interpreter, MySQL, and the web server cooperate to return the page
Each step in the chain is listed here:
This may seem like a lot of steps, but all of this processing happens automatically every time a web page with PHP code is requested.
When developing dynamic web pages, you work with a variety of variables and server components, which are all important to having an attractive, easy to navigate, and maintainable web site. Next, it's time to install the three major cogs needed to make this work: Apache, PHP, and MySQL.