Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4617462
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:07:39+00:00 2026-05-22T02:07:39+00:00

Got asked this interesting interview question today. Explain in detail the process by which

  • 0

Got asked this interesting interview question today.

Explain in detail the process by which a client machine requests a file (say file.php) from the server, and then receives that desired file along with its necessary JS/CSS/images/video files and they appear on the client’s browser screen.

Here is what I do know and what I did say:

So a request is sent, then the server sees that the file.php file is being requested, and because it has a .php extension, it first uses the PHP engine to parse any PHP code inside the file, and then once it is done, it outputs back to the client machine the resulting file.php file (as a response). The browser then takes that response and parses the HTML and necessary JS and CSS code, then displays it to the browser.

My answer is pretty basic and not as detailed as it should be. I thought about my response and came up with new questions:

  1. What, literally, is a “request”? Is it basically just the textual header file that gets sent to the server?

  2. What about a “response”? Is the response itself the parsed file.php file that gets sent back to the client machine?

  3. What if the file.php file contains a reference to a script.js file and a style.css file? At which stage do those files get served back to the client machine? Do they come in as separate headers or what?

  4. Above in my answer, I’m not sure if I was correct when I said “…because it has a .php extension, it first uses the PHP engine to parse any PHP code inside the file.” Is that really the reason why the server parses the code inside the file, or does the server scan ALL kinds of files by default to check for any PHP code they might contain?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:07:40+00:00Added an answer on May 22, 2026 at 2:07 am

    First of all, I think your answer was quite good. It definitely describes the basic process you were asked about.

    1) What, literally, is a “request”? Is it basically just the textual header file that gets sent to the server?

    Yes, an HTTP request is a text message to a server including, mostly: the requested path, any parameters to that path, client info (user agent, session, cookies etc.).

    2) What about a “response”? Is the response itself the parsed file.php file that gets sent back to the client machine?

    Sort of. An HTTP response consists of a header text that describes: the response status (success or errors such as file not found, internal server error etc.), some content metadata (content type, encoding…) and the content.
    The content could be an HTML document. It could also be a CSS or Javascript file, a PNG image or whatever other files the web server serves. The meta-data in the header describes the content in a way that the browser (or any client) can figure out how to handle it.

    3) What if the file.php file contains a reference to a script.js file and a style.css file? At which stage do those files get served back to the client machine? Do they come in as separate headers or what?

    Firstly, the process you just described would finish. Meaning, a request was sent and then a response was returned. Assuming the response is an HTML document, the browser parses the document and looks for external content: CSS stylesheets, Javascript files, image files, flash embeds and the like.
    For each of these external files, the browser sends a new request using the exact same process. After getting a CSS file, for example, the browser knows to apply it to the document it just parsed.

    4) Above in my answer, I’m not too sure if I was correct when I said “…because it has a .php extension, it first uses the PHP engine to parse any PHP code inside the file.” Is that really the reason why the server parses the code inside the file, or does the server scan ALL kinds of files by default to check for any PHP code they might contain?

    Well, it depends on the server configuration, but most of the times, yes;
    The server is usually configured to handle all .php files the same, meaning pass them to the PHP parser and wait for its response.

    By the way, this differs for different server-side software technologies. While this is the way PHP works, other technologies (e.g. Ruby on Rails, some .NET languages) are handled in a different way.


    Great question, and good for you for showing interest!
    For additional information, I suggest you check out HTTP on Wikipedia.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(I asked this question in another way , and got some interesting responses but
When I asked this question I got almost always a definite yes you should
I originally asked this question on RefactorMyCode , but got no responses there... Basically
Yesterday, I asked this question and never really got an answer I was really
In this question, I asked about breaking a dataset into subsets, and got a
I asked a question earlier , and got an excellent response, but, being a
Last time I asked about the reverse process , and got some very efficient
A while ago, I asked a question about $ , and got useful answers
I asked how to render a UserControl's HTML and got the code working for
Got a bluescreen in windows while cloning a mercurial repository. After reboot, I now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.