Search code examples
deploymentwebserverweb-development-server

Which part of the server-side stack responds to HTTP requests?


Hopefully this question is appropriate for this site -- please let me know if not!

I am reading a textbook on web development (Fundamentals of Web Development by Connolly and Hoar, 3e) and while I am still early on, it has at this point fleshed out the nature of the "server-side stack" as consisting of the OS, a web server software, database software, and scripting software. I had thought that I understood that it was the web server software's responsibility to understand the incoming HTTP requests to the server and then dispatch the database or scripting software as required, but the text does say the following:

Finally (or perhaps firstly if you are starting a project from scratch) is the choice of server-side development language or platform. This development platform will be used to write software that responds to HTTP requests. The choice for a LAMP stack is usually PHP or Python.

This makes it seem like the scripting software is used to create executables that respond to the incoming HTTP requests. Can someone set me straight here?


Solution

  • You are correct in both cases, it is just you are perhaps conflating two separate levels of "responding".

    The web server OS, software and networking layer is responsible for handling incoming HTTP request at the basic level. Scripting software, which could be written in languages like PHP, Go, Node, Python, etc, is used to write server-side code that responds to these basic HTTP requests.

    Perhaps an analogy will help...

    Think about who is responsible for responding to your request for a particular dish in a restaurant - the waiter or the chef? The answer is both, at separate levels of "responding".

    You request a dish from the waiter, who interprets what you say, writes it down and passes the formatted order on to the chef. The chef takes the order and creates a meal. Then the waiter brings the meal to your table.

    You request a resource from the web server, which interprets the request and hands it off to your scripting software. The scripting software creates a response based on the request. Then the web server delivers that response back to the client.