How a Web Application Works
Path from click to response
Every modern web application follows the same basic flow: the user in the browser sends an HTTP request, the web server (Apache/Nginx) forwards the request to the PHP interpreter, PHP reads or writes data to the MySQL database as needed, then generates a response that the server returns to the browser. Understanding this chain helps with debugging and architecture design.
Browser
Displays HTML/CSS/JS and sends GET/POST requests to a URL (e.g. /login.php). Developer Tools (F12) show the network, errors, and server responses.
Server
Apache from the XAMPP package maps the htdocs folder to the localhost domain. The PHP module processes .php files before anything is sent to the client.
Database
MySQL stores persistent data: users, orders, posts. PHP connects via the PDO or mysqli extension.
Browser --GET /products.php--> Apache
Apache --execute--> PHP
PHP --SELECT * FROM products--> MySQL
MySQL --rows--> PHP --HTML--> BrowserTrack the request in Developer Tools
Open any .php file, press F12 → Network, refresh the page, and click on the request. Check the status code (200), response type, and load time. If you later add a MySQL query, response time increases – that is a normal signal to optimize the query.
Mini flow diagram
1. Browser šalje HTTP zahtev
2. Apache prosleđuje PHP fajl interpreteru
3. PHP (opciono) čita/piše u MySQL
4. PHP echo-om gradi HTML
5. Apache vraća HTML browseru 