Installing XAMPP / WAMP / MAMP
Running PHP requires three cooperating pieces: a web server to accept HTTP requests, the PHP interpreter to execute your scripts, and usually a database to persist data. Installing and wiring up Apache, PHP, and MySQL by hand — matching versions, editing config files, pointing PHP at the right extensions — is a real chore, and it is not where a beginner should be spending their first hour. Stacks like XAMPP, WAMP, and MAMP solve this by bundling all of it into a single installer that is already configured to work together out of the box.
What the acronyms actually mean
Each name describes the bundle. XAMPP stands for X (cross -platform — it runs on Windows, Linux, and macOS), Apache, MySQL (in practice, MariaDB in current builds), PHP, and Perl. WAMP is the Windows-only equivalent (Windows, Apache, MySQL, PHP), and MAMP is the macOS equivalent (Mac, Apache, MySQL, PHP). All three ship the same underlying idea — a preconfigured Apache + MySQL/MariaDB + PHP stack with a graphical control panel — they just differ in platform support and the exact UI of that control panel.
Stack | Platforms | Bundles |
|---|---|---|
XAMPP | Windows, Linux, macOS | Apache, MariaDB/MySQL, PHP, Perl |
WAMP | Windows only | Apache, MySQL, PHP |
MAMP | macOS (and Windows, via MAMP for Windows) | Apache/Nginx, MySQL, PHP |
Why beginners reach for a stack instead of installing PHP manually
One installer instead of three separate downloads that each need their own setup and version compatibility checks.
Apache is pre-wired to hand
.phpfiles to the PHP interpreter — no manually editinghttpd.confto register the PHP module.A control panel GUI to start/stop services, instead of managing background processes from a terminal.
A sensible default folder to drop project files into, so "where do I put my code" is answered for you.
Easy to fully uninstall or reset — useful while you are still experimenting and might misconfigure something.
Step 1: Download XAMPP
Go to apachefriends.org and download the XAMPP installer for Windows. Pick a build whose bundled PHP version matches what you intend to learn or deploy against — as of this writing, XAMPP ships PHP 8.2.x by default, which is a good modern baseline (PHP 8.1+ brought enums and readonly properties, and 8.2+ added readonly classes, so a recent build is worth having).
Step 2: Run the installer
Run the downloaded .exe as Administrator. Windows Defender or your antivirus may flag the installer since it writes into C:\ at the root level — this is expected for XAMPP. Accept the default install location, C:\xampp, unless you have a specific reason to change it; a lot of documentation and tutorials assume that exact path. On the component-selection screen you can leave everything checked, though Apache, MySQL, and PHP are the three you actually need for PHP development.
Step 3: Launch the XAMPP Control Panel
After installation, open the XAMPP Control Panel (xampp-control.exe, in C:\xampp, or via the Start menu shortcut). This window lists every bundled service — Apache, MySQL, FileZilla, Mercury, Tomcat — each with a Start/Stop button and a status light. You do not need most of these for basic PHP work.
Step 4: Start Apache and MySQL
Click Start next to Apache and next to MySQL. Both rows should turn green within a few seconds, and the panel will show the PIDs and ports each service is bound to (Apache typically on 80 and 443, MySQL on 3306). If Apache refuses to start, the log window at the bottom of the control panel almost always names the exact conflict — most commonly "port 80 in use."
XAMPP Control Panel — healthy state
Module PID(s) Port(s) Actions Status Apache 4820, 6172 80, 443 Stop Admin [Running] MySQL 5544 3306 Stop Admin [Running] FileZilla Start Admin Mercury Start Admin Tomcat Start Admin
Step 5: Find and use htdocs
Apache's document root — the folder it actually serves files from — is C:\xampp\htdocs. Any file you place there becomes reachable over HTTP. Drop a file named hello.php directly in htdocs, and it is served at http://localhost/hello.php. If you instead create a subfolder, say C:\xampp\htdocs\myapp, its files are served under http://localhost/myapp/.
C:\\xampp\\htdocs\\hello.php
<?php
echo "Hello from PHP running under XAMPP!";
echo "<br>Current time: " . date('Y-m-d H:i:s');Step 6: Verify the install with phpinfo()
PHP's built-in phpinfo() function prints a full diagnostic page — installed version, loaded extensions, configuration values from php.ini, server variables — and is the standard first check after any PHP install. Create a dedicated test file rather than reusing hello.php.
C:\\xampp\\htdocs\\info.php
<?php phpinfo();
With Apache running, open http://localhost/info.php in a browser. A correctly wired install shows a page headed "PHP Version 8.2.x" (or whichever version you installed) with tables listing every active extension and configuration directive. If you instead see the raw PHP source as plain text, Apache is not passing .php files to the PHP interpreter — almost always because Apache is not actually running, or you opened the file directly from disk (a file:// path) instead of through http://localhost.
WAMP as a Windows-only alternative
WAMPServer covers the same Apache + MySQL + PHP combination but is built specifically for Windows and nothing else. Its control lives in a system tray icon instead of a separate window: left-click to start/stop all services, right-click for a menu that lets you switch PHP versions, toggle Apache modules, and jump straight to www (WAMP's equivalent of htdocs, usually at C:\wamp64\www). If you are certain you will only ever develop on Windows, WAMP's version-switching menu is genuinely more convenient than XAMPP's for juggling multiple PHP versions side by side.
MAMP as a macOS alternative
MAMP is the macOS-native option (a Windows build also exists, confusingly called "MAMP for Windows"). It installs to /Applications/MAMP, serves files from /Applications/MAMP/htdocs by default, and its control panel is a native macOS app with Start Servers/Stop Servers buttons rather than a Windows-style tray or standalone panel. A free tier covers Apache, MySQL, and PHP version switching; a paid "MAMP PRO" tier adds virtual hosts and scheduled tasks through the GUI instead of editing config files by hand.
Common first-run problems
Apache will not start— usually port 80 is already taken by IIS, Skype, or another instance of Apache/Nginx. Stop the conflicting service, or change Apache to listen on port 8080 inhttpd.confand browse tohttp://localhost:8080.MySQL will not start— often a leftover MySQL/MariaDB service already running from a previous install claiming port 3306..php files download instead of executing — Apache is not running, or the file was opened via file:// instead of http://localhost/...
"localhost" refuses to connect— confirm Apache actually shows green/Running in the control panel before troubleshooting anything else.