What Is XAMPP and How Do You Use It for Local PHP Development?

XAMPP is a free, open-source distribution that bundles Apache, MariaDB, PHP, and Perl into a single installer, letting you run a PHP development environment on your own computer without configuring each component separately. It's available for Windows, Linux, and macOS, and is aimed at developers who want a working local server quickly rather than a production hosting stack. If you need to test PHP code, run a local database, or preview a site before deploying it, XAMPP is one of the fastest ways to get there.

What XAMPP actually contains

The name is an acronym for the components it packages:

Letter Component Role
X Cross-platform Runs on Windows, Linux, and macOS
A Apache The web server that handles HTTP requests
M MariaDB The database (a drop-in MySQL-compatible fork)
P PHP The server-side scripting language
P Perl A general-purpose scripting language

Because it ships these together and pre-configures them to work as a unit, XAMPP is called a distribution rather than just an application. You install one package instead of four, and the pieces are already wired to talk to each other.

The official site describes XAMPP as "a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl," maintained by Apache Friends, a non-profit project that promotes the Apache web server.

Downloading and installing

Installers are published per operating system on the Apache Friends download page. As of the current listings there:

  • Windows: XAMPP 8.2.12 (PHP 8.2.12)
  • Linux: XAMPP 8.2.12 (PHP 8.2.12)
  • macOS (OS X): XAMPP 8.2.4 (PHP 8.2.4)

Note that the version numbers differ across platforms — Windows and Linux were on 8.2.12 while macOS was on 8.2.4 at the time of that listing. Newer releases for Linux and macOS are noted as coming later than the Windows builds, so check the download page for the current version rather than assuming all three match.

General install flow:

  1. Download the installer for your OS from the official download page.
  2. Run it and accept the default install location unless you have a reason to change it.
  3. On Windows and macOS, the installer may prompt about firewall access for Apache — allow it so the server can accept local connections.
  4. Finish the wizard and launch the XAMPP Control Panel.

Starting Apache and MySQL

The XAMPP Control Panel is the main interface for managing the stack. It lists each component (Apache, MySQL/MariaDB, FileZilla, Mercury, Tomcat) with Start and Stop buttons.

  1. Open the Control Panel.
  2. Click Start next to Apache. The status should change to "Running" and the port (typically 80 and 443) will be shown.
  3. Click Start next to MySQL. This starts MariaDB on port 3306.

Verifying it works: open a browser and go to http://localhost or http://127.0.0.1. If Apache is running, you'll see the XAMPP welcome/dashboard page. That page also links to phpMyAdmin, which is the web-based database admin tool bundled with the stack — useful for confirming MariaDB is reachable.

Where your project files go

XAMPP serves files from a folder called htdocs, located inside the XAMPP installation directory (for example, C:\xampp\htdocs on Windows, or /opt/lampp/htdocs on Linux).

To run your own PHP project:

  1. Create a folder inside htdocs, e.g. htdocs/myproject.
  2. Put your PHP files there — for a quick test, a file named index.php containing <?php echo "Hello"; ?>.
  3. Visit http://localhost/myproject/ in your browser.

The folder name under htdocs becomes the path segment in the URL, so htdocs/myproject maps to localhost/myproject. Files placed directly in htdocs are served at the root (localhost/).

Common setup problems

Port 80 already in use. Apache fails to start if another program (often IIS, Skype, or another web server) holds port 80. The Control Panel's Netstat button shows what's using which port. You can either stop the conflicting program or change Apache's listening port in its config file, then access your site at http://localhost:8080 (or whichever port you chose).

MySQL won't start. This is frequently another MySQL/MariaDB instance already running on port 3306, or a leftover service from a previous install. Check for existing database services and stop them, or change the port in the MariaDB configuration.

Firewall prompts. If you decline the firewall exception, Apache may start but be unreachable from the browser. Re-allow it in your OS firewall settings.

Permission errors on Linux/macOS. On Linux, XAMPP's management commands typically need elevated privileges (e.g. sudo /opt/lampp/lampp start). On macOS, files under htdocs may need correct ownership for Apache to read them.

When XAMPP is the right choice — and when it isn't

XAMPP fits local development and learning: you want a self-contained PHP + database environment on your machine, you're testing code, or you're following a tutorial that assumes a LAMP-style stack. It's explicitly a development environment, not a hardened production server — the default configuration is built for convenience, not security.

If you're deploying to real users, you'd typically use a production web server setup or a managed host instead. And if you only need one component (say, just PHP without a database), a lighter install may suit you better than the full bundle.

The practical next step: download the installer for your OS, start Apache and MySQL from the Control Panel, drop a test file into htdocs, and confirm it loads at localhost. That loop — edit, refresh, repeat — is the core of local PHP development with XAMPP.

apachefriends.org
XAMPP is an easy to install Apache distribution containing MariaDB, PHP and Perl.