In this part, we will learn about Request response cycle in PHP. This cycle describes the way a browser and web server can communicate to process the user request. You must have a basic concept of communication between browser and web server. It will help you in future when you have to work on web development. 

    PHP for beginners Part 4, writing the first program

Suggested:  What is Web Server? How users make request.?

Whenever we write something in the search bar of our browser, we are actually making an HTTP request to web server. The web server responds back to our request by providing our required data. The complete cycle works in the following scenario.

Working

The browser sends the request to the web server of the specific domain. In our case the web server is localhost. The apache web server handles that request on localhost. The apache looks for that specific request in the file system. In the file system, the apache server recognizes the file. In our case, it’s PHP file. It goes to process the PHP file. During processing, it also goes to the database to store or retrieve data if required. After completing processing it returns the file to the browser as a response. The file returned to the browser is in HTML format.

Below is the screenshot for request-response cycle in PHP.

You may like: 

 

It is necessary to keep in mind the request response cycle of PHP. We will also use it in our upcoming tutorials.

You may love: How Search Engines work?

LEAVE A REPLY

Please enter your comment!
Please enter your name here