PHP Install
You don't need to install anything to follow this tutorial — the in-browser editor runs PHP via WebAssembly. For real projects, install PHP locally.
The easy way — all-in-one stacks
| Tool | OS | What you get |
|---|---|---|
| XAMPP | Windows / macOS / Linux | Apache, PHP, MySQL, phpMyAdmin in one installer. |
| Laragon | Windows | Lighter than XAMPP, with one-click projects. |
| Herd | macOS / Windows | Modern, fast, Laravel-friendly. |
| MAMP | macOS / Windows | Long-standing local stack. |
| DDEV / Docker | Any | Reproducible per-project containers. |
Verify the install
SHELL
php -v # PHP 8.x.x (cli) ... php -m # Shows enabled extensions php -S localhost:8000 # Built-in web server for quick demos
Your first script
PHP — hello.php
<?php echo 'Hello, world!'; echo PHP_EOL, 'Running PHP ', PHP_VERSION;
SHELL
$ php hello.php Hello, world! Running PHP 8.3.0
Editor choices
- VS Code + the PHP Intelephense extension — most popular setup.
- PhpStorm — JetBrains' PHP IDE; rich refactoring and Laravel/Symfony tooling.
- Anything with syntax highlighting + a terminal works.
Tip: Install Composer right after PHP — it's the package manager and you'll need it for any non-trivial project.
Example
Example
<?php // XAMPP / Laragon / Herd give you Apache + PHP + MySQL. // php -v shows your installed version. echo phpversion();Try it Yourself »
Exercise
Show installed PHP version on the command line.
php
A two-character flag.
Discussion
Loading…