Now you have a good knowledge about how to run PHP code on XAMPP. But have you ever thought about how this PHP is showing the content on the browser or how PHP is Parsed. Let's see the scenario.
Here we need to understand 2 terminology.
- Client Side and
- Server Side
The server always gives back response whenever cient requests. Means the server's job is to give response only.
The client always requests to server for something to execute. Means the client's job is to request only.
Let's see how PHP is Parsed or how PHP works?
- The Web browser requests a file with a .php extension.
- The Web server gives response as, "Hey! Someone wants a PHP file, which means this is a file that needs to be parsed," and sends the request on to the PHP parser.
- The PHP parser finds the requested file and scans it for PHP code.
- When the PHP parser finds PHP code, it executes that code and places the resulting output (if any) into the place in the file formerly occupied by the code.
- This new output file is sent back to the Web server.
- The Web server sends it along to the Web browser.
- The Web browser displays the output.
Let's see how any website works on WWW?
The processing of any website irrespective of the language we used in it, the processing will be same whether its a PHP website or ASP website or JSP website. Let's see the different steps.
- When you type a website address for instance http://www.phphunger.com/ and hit enter. What actually happens is that the browser sends a request to the server for the index.php page.
- The web server sends the index.php page to the web application server where it is parsed.
- If there is any requirement of database connectivity in the index.php, it is connected to the database for the desired purpose and the database returns the result.
- Over all at web application server the index.php page is actually parsed to an html document which is send back to the web server.
- The web server sends back the requested page to the client (browser) where you can view the requested page.
Did You Enjoy this Article ?
If yes, Then enter your email below to get
more such great articles in your inbox
For FREE !