Unit 10 ยท Back-End Programming

10.1.1Client-Server Architecture

BrowserWeb server (Apache)PHP engineDatabase (MySQL)1GET /products.php2run products.php3SQL query4rows of data5built HTML6HTTP response (HTML)7browser rendersHTML, CSS, JSThe visitor only ever receives the output, never the PHP source.
Client-server architecture: what happens when the browser requests a PHP page

An HTTP request contains a method (GET, POST...), a URL, headers (e.g. Cookie, Content-Type) and optionally a body. A response contains a status code, headers and a body.

StatusMeaning
200OK
301 / 302Redirect (moved permanently / temporarily)
400Bad request
401 / 403Not logged in / not allowed
404Not found
500Server error (bug in your PHP code)

See it live: open Chrome DevTools, Network tab, reload a page, click a request.