Skip to the workspace
Pebellslearn by building
Introduction to PHP  ›  Lesson

What PHP Is and Where It Came From

What is PHP? 12 minPHP is a server-side scripting language that runs code on the web server and sends only the resulting output, usually HTML, to the browser.

Set up PHP and run your first file

Install PHP for command-line use first. You can learn the language without configuring Apache, a database, or an entire web-server bundle.

Already set up? Continue to the lesson

New to coding? Meet the tools and find the terminal
PHP interpreter
Executes .php source files.
CLI
The terminal interface used for the first program.
Local development server
PHP can serve a practice page locally later; this is not a production server.

A terminal is a window for commands. Its shell interprets those commands. PATH is the list of folders the shell searches for programs. An editor extension adds editing help; it usually does not install the language itself.

In VS Code, open your project folder, then choose View → Terminal. Type at the cursor in the Terminal panel, not in Output, the source file, or the browser address bar. Our command blocks omit prompt symbols such as $ and >; do not add them.

Official VS Code screenshot: the Terminal tab is selected below the editor, with the PowerShell shell name at the right and a command prompt at the left.
Find the Terminal tab and shell name. Open full-size screenshot (new tab).

The dropdown next to the plus button selects a shell. Choose the shell named in your operating-system instructions below. Available choices depend on what you installed.

Official VS Code screenshot: the arrow beside the terminal plus button opens a list containing PowerShell, Command Prompt, Git Bash and Ubuntu WSL.
Official documentation screenshots by Microsoft, VS Code terminal guide, CC BY 3.0 US. Unmodified; your version may look different.

Choose a system to see its installation steps. A computer is needed for these local setup instructions.

Official documentation and illustrated guides

Instructions reviewed 2026-10-27. Use the linked installer page for current versions and supported operating systems.

Continue to the lesson

php / What PHP Is and Where It Came From

Explore each scene at your own pace.

01 · The rule

The rule

What PHP Is and Where It Came From

PHP is a server-side scripting language that runs code on the web server and sends only the resulting output, usually HTML, to the browser.

Follow a server-side program from a request to the response a browser receives.

Pageturn is a small online bookshop. Every visitor should see today's prices and whether Dune is in stock, so the page must be built fresh for each request. That is the job PHP was made for.

The rule

PHP runs on the server, builds the page, and sends only the result.

What it is. PHP is a general-purpose scripting language that is best known for building web pages on the server. The name is a recursive acronym: PHP: Hypertext Preprocessor. A PHP file can mix plain HTML with code:

<p>Dune costs <?php echo 9.99; ?> today.</p>

The browser asks for the page, the web server hands the file to PHP, PHP runs the code, and the browser receives only <p>Dune costs 9.99 today.</p>. The visitor never sees the PHP source.

Where it came from. In 1994 Rasmus Lerdorf wrote a few small tools to track visits to his personal home page. Others wanted them, and they grew into a language. Key milestones:

  • PHP 3 (1998): rewritten by Andi Gutmans and Zeev Suraski; the first version that looks like modern PHP.
  • PHP 4 (2000): the Zend Engine arrived underneath.
  • PHP 5 (2004): proper classes and objects.
  • PHP 7 (2015): roughly twice as fast, plus type declarations for scalar values. (PHP 6 was abandoned, so the numbering skipped it.)
  • PHP 8 (2020 onward): match, named arguments, the nullsafe operator ?->, union types and a JIT compiler; later 8.x releases added enums, readonly properties and more.

This course uses PHP 8.x; check the date on older tutorials before copying a pattern.

Running it yourself. Beginners often install a bundle that packages a web server, PHP and a database together: XAMPP (any system), WAMP (Windows), MAMP (macOS) or a LAMP setup on Linux. You only need PHP itself to start, though: php -S localhost:8000 runs a small built-in development server in the current folder.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.