How to Install XAMPP and WordPress on Windows Localhost
Once you’ve experienced speed and reliability, there’s no going back. Remember the era before high-speed internet, when you had to wait for videos to buffer? Awful times. Three cheers for the modern internet speeds!
If you’re used to developing your sites on a live server, that’s exactly what shifting to a local development environment such as XAMPP would feel like. Blazing fast development and exceptional reliability. You can never go back to the old ways.
In this post, I’ll be showing you how to install XAMPP on your Windows PC and have a WordPress site (including Multisite) running on it in just a few minutes. I’ll also cover some common issues that you may encounter and how to overcome them.
Let’s get going.
If you prefer a video instead, we’ve got you covered!
What is XAMPP?
In a nutshell, XAMPP is a local server that you can install on your laptop/desktop to mimic an actual web server.
It’s a completely free, open source Apache server distribution with MariaDB (formerly MySQL), PHP, and Perl. XAMPP is available for all major operating systems, and is extremely easy to install and use. This explains why it’s the most popular PHP development environment.
Here’s what the alphabets in XAMPP stand for:
- X — cross-platform (X), as it supports multiple operating systems
- A — Apache HTTP Server
- M — MariaDB (formerly MySQL)
- P — PHP
- P — PERL
Apart from the core components mentioned above, XAMPP usually comes with other useful tools such as Mercury mail server, phpMyAdmin for database administration, Webalizer for web server log analysis, OpenSSL, Apache Tomcat for running Java code, and FileZilla FTP server.
As a professional WordPress developer, I cannot stress enough how beneficial having a local development environment is. It lets me setup new WordPress installs in a jiffy. And since it’s hosted locally on my computer, there’s no delay in uploading my changes and see them come alive on the browser.
Want to try a new theme? Just copy and paste it into your
wp-content/themes directory. And bam! It’s loaded instantly. The same with plugins and changing any settings. No server delay, no upload hassles, no unnecessary waiting times. Everything happens in real time.
It’s like taking your car on a racetrack and pushing it to its limits. The perfect testing environment to go wild without any repercussions (well, almost).
With XAMPP installed on my PC, I can continue working on my site even if I’m at a remote location with no connectivity. Developing locally is also much secure, as your site is offline and away from the prying eyes of hackers (and pesky clients).
Why XAMPP for WordPress?
Like all software, WordPress has certain prerequisites to run. The current recommended WordPress requirements are:
- PHP version 7.3 or greater
- MySQL version 5.6 or greater OR MariaDB version 10.1 or greater
- HTTPS support
- Apache OR nginx server
XAMPP checks all the boxes listed above. It’s free, reliable, easy to use, and works on all major platforms. You can’t go wrong with it.
Let’s Install XAMPP on Windows
Step 1: Download XAMPP
Start off by downloading the latest version of XAMPP from Apache Friends website. The current up-to-date version of XAMPP is 7.3.8 / PHP 7.3.8.
Note: If you’re using Linux or OSX, the installation steps are pretty much the same. Just make sure to download the appropriate version of XAMPP for your OS.
Step 2: Install XAMPP
Once downloaded, run the XAMPP installer file.
Select the components you want to install. If you’re planning to install a WordPress site with XAMPP, you only need Apache, MySQL, PHP, and phpMyAdmin. I’ll check all the components as I’d like to experiment with them later.
Choose the installation directory for XAMPP (default recommended).
Uncheck Learn more about Bitnami option. Bitnami provides all-in-one tools to install popular open source apps on top of XAMPP. This includes add-on modules for installing WordPress too. However, we’ll be installing it manually here.
You may be presented with a Windows Security Alert at the end of the installation. You need to whitelist Apache HTTP Server from your Windows Defender Firewall by clicking the Allow access button. Make sure to check the “Private networks, such as my home or work network” option. This is very important. XAMPP won’t work if you don’t check this and click Allow access.
Complete the setup and run XAMPP Control Panel.
Installation Note 1: Deactivate UAC under Windows Settings
You might be presented with a User Access Control (UAC) warning by Windows. Nothing to worry much. Just make sure that you don’t install XAMPP under your
Program Files directory, as UAC can interfere with XAMPP’s writing permissions to this directory. The default installation directory is
C:\XAMPP. So, if you don’t change it, you should be good.
If you want to learn how to deactivate UAC (not recommended unless absolutely necessary), Microsoft Windows support is a good place to start.
Installation Note 2: Deactivate Antivirus and/or Firewall Temporarily
Some antivirus or firewall programs can cause issues with your XAMPP installation. If that’s the case, it’s suggested that you deactivate them temporarily until XAMPP is installed successfully.
Read the XAMPP Windows FAQs page for more.
Step 3: Open the XAMPP Control Panel
The XAMPP Control Panel sports a simple user interface that lists all the modules of your local server. It allows you to Start/Stop individual modules, access their Admin area, Config files, and Logs with just a single click. Its bottom section also displays all your actions and errors (if any).
Apart from the options discussed above, the XAMPP Control Panel also features other buttons on its right side:
- Config: to configure overall XAMPP settings
- Netstat: display all active TCP connections (and ports) on your computer
- Shell: starts XAMPP in a custom command line (CMD)
- Explorer: opens the XAMPP root folder in Windows Explorer
- Services: shows all Windows services under Microsoft Management Console
- Help: links to Apache Friends Support Forum
- Quit: quit XAMPP Control Panel (the server will continue to run in the background)
Step 4: Start Apache and MySQL Modules
Click the Start button beside Apache module. If everything’s set correctly, your Apache server should start successfully under ports 83 and 443.
You can access your Apache server’s dashboard by clicking the Admin button beside it. Alternatively, you can also reach it via http://localhost/dashboard/ URL in your browser.
Then Start the MySQL module. If you’re presented with a Windows Security Alert to whitelist mysqld.exe, click Allow access. Like before, make sure that you’ve ticked the “Private networks,…” option.
You can access your phpMyAdmin dashboard by clicking the Admin button beside MySQL module. Or you can simply go to http://localhost/phpmyadmin/ in your browser. Here, you can manage the MariaDB (or MySQL) databases of your web projects.
This concludes the setup of XAMPP as your local development environment. It’s now ready to host any PHP-based software (e.g. WordPress).
Testing Your XAMPP Installation
The best way to check whether your local server has been installed and configured correctly is to create a PHP test page, place it in XAMPP’s localhost folder, and then try accessing it via your browser.
Let’s do that now. Create a new folder called test in your
C:\xampp\htdocs\ directory. This directory can also be accessed easily by clicking the Explorer button in XAMPP Control Panel and then going to htdocs folder.
Create a file called test.php with the code below and place it in
Try visiting http://localhost/test/test.php in your browser. If it displays the words “Hello World! Welcome to WPMU DEV”, then XAMPP is successfully installed and configured on your system.
Installing WordPress Locally with XAMPP
Step 1: Create a New MySQL Database for Your WordPress Installation
Before we install WordPress, we need a database.
In your XAMPP Control Panel, click the Admin button in the MySQL section. A new browser window will automatically open with the phpMyAdmin dashboard interface. Click on Databases near the top-left.
You’ll now be prompted to create a new database. I’ve named mine wpmudev.
Once you’ve entered a name, click Create and close the window.
Step 2: Download and Install WordPress
Unzip WordPress in the right folder under XAMPP. In my case, it’s
C:/xampp/htdocs. Rename it to whatever you like, but it’s recommended to give this folder the name of your site. I’m going to call this installation of WordPress wptest.
Now, go into your site’s WP folder, find the wp-config-sample.php file, and rename it wp-config.php.
Open the file and scroll down until you see the following lines:
These lines of code define the login details for your database. Update them as per the instructions below:
- Replace“database_name_here” with the name of your database, which in my case is wpmudev.
- Replace “username_here” with “root” and edit “password_here” field to be empty.
- Save the file and close it
We can continue with our WordPress installation now. Open your browser and go to http://localhost/wptest/.
You should see the WordPress installation’s language selection screen load.
Once you’ve chosen your language, continue onto the next screen. Enter your site title, admin username, and password details. Click Install WordPress.
Congrats, you’ve successfully installed WordPress on your local server.
Setting Up WordPress Multisite Locally with XAMPP
Step 1: Enable WP Multisite in your wp-config.php File
Open your wp-config.php file and add the following line just above the line that says /* That’s all, stop editing! Happy publishing. */.
This will activate the Multisite installation mode on your WordPress site.
Step 2: Setup Your Multisite Network
Go to your WordPress dashboard, and then to Tools > Network Setup.
Enter a name for your multisite network and your network admin email address. Then click Install.
WordPress will now prompt you to edit your wp-config.php and .htaccess files.
Step 3: Follow WordPress’ Onscreen Instructions
Open your wp-config.php again and add the code given by WordPress underneath your previous edit.
Next, open .htaccess file and replace all its code with the one given by WordPress (Note: you’ll have to replace the contents completely here, not just add/edit).
If you can’t find the .htaccess file, make sure to enable display hidden files settings on your computer. If you still can’t find it, then create one in the same directory as your wp-config.php file.
Multisite should now be successfully activated on your WordPress installation.
You’ll have to log in again. And when you do, you’ll be able to access individual sites in your multisite network from your dashboard.
You can also create a new network site from here by clicking the Add New button.
XAMPP allows you to set up a local server environment on your Windows machine easily. The best thing about it is that it’s completely free and open source. Once installed, you’ll forget that it’s even there.
With XAMPP, you can develop and test WordPress sites swiftly on your system, rather than doing it the hard way on a live site. You can try different themes and plugins, test their various features, and experiment with many other aspects of your site without breaking a sweat.
What’s more, you can also install as many instances of WordPress as you like (including Multisite). Who knew, the saying “think global, act local” holds true for web development too!