Skip to content
AgileLogics
4 min read

How PHP Code Runs

Prerequisites: Your first PHP script

Historically, PHP ran as a request-per-page model: a web server (Apache/Nginx) receives an HTTP request, hands it to the PHP interpreter, which runs the matching .php file top to bottom and outputs the result — then the whole process starts fresh for the next request, with no state carried over automatically.

PHP's built-in development server is the fastest way to try this locally, with no separate web server needed:

php -S localhost:8000

Visiting http://localhost:8000/hello.php runs that file and shows its output. In production, PHP-FPM (FastCGI Process Manager) handles this same request/response cycle far more efficiently, covered in Level 3.