Web Development — Level 3: Back-End with PHP, MySQL & Laravel
Free preview

How the server side works

1 / 3

Client and server

  • Browser sends a request
  • Server runs code, reads the database
  • Returns HTML or JSON
2 / 3

Why PHP

  • Powers a large share of the web (WordPress, Laravel)
  • Cheap hosting everywhere
  • Modern PHP 8 is fast and typed
3 / 3

Local setup

  • PHP 8.2+, Composer, MySQL
  • Laragon or XAMPP on Windows
  • php -S localhost:8000

Lecture notes

In Levels 1 and 2 everything ran in the browser. Real applications also need a server: a program that receives requests, checks who the user is, reads and writes a database, and sends back HTML or JSON. This is the back end.

The request–response cycle

  1. The browser sends an HTTP request: GET /courses or POST /login.
  2. The web server (Nginx, Apache or PHP's built-in server) passes it to PHP.
  3. PHP runs your code, queries MySQL, builds the response.
  4. The browser receives HTML (a page) or JSON (for JavaScript).

The user never sees your PHP code — only its output. That is why secrets (database passwords, API keys) live on the server.

Why PHP?

PHP runs a large part of the web (WordPress, Wikipedia, Laravel applications), is available on almost every host, and PHP 8 is fast with types, enums and attributes.

Setting up

  • Windows: Laragon or XAMPP installs PHP, MySQL and a web server together.
  • Install Composer, PHP's package manager.
  • Check: php -v, composer -V.
  • Quick test server: php -S localhost:8000 in a folder containing index.php.
<?php
echo "Hello from the server, it is " . date('H:i');
Want to go further?
20 h · Enroll to access every lesson and earn the certificate.
Get Started Free