How to Setup WordPress using XAMPP on Windows

How to Setup WordPress using XAMPP on Windows.  If you needing to create WordPress site on your computer using XAMPP we are help to assist. If a Graphical User Interface (GUI) is not your proffered option, then a stack based solution, such as XAMPP is the way to go.  This lesson will look at how to install WordPress using XAMPP where you can have your site up and running on your computer. We will use Apache, MariaDB/MySQL and phpMyAdmin to install WordPress. Let’s start with table of contents.
 

Table of Contents

Use XAMPP to run Apache web server and the MariaDB (MySQL) database management system on your local Windows computer. It makes installing WordPress site easy and provides the ideal environment to build your blog or website before going live.

Let’s start this article how to Setup WordPress using XAMPP on Windows with introduction what XAMPP server is.

What is XAMPP?

From the XAMPP website:

XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use.

XAMPP server is indeed incredibly easy to install and use, helping us run a hosting environment for free. But if you’re new to website development MariaDB, PHP, and Perl are likely going to be unfamiliar.
In short:
  • MariaDB: A database management system. We’ll use it to create our WordPress database.
  • PHP: A scripting language that can create dynamic websites, like WordPress
  • Perl: A feature-rich programming language

Note: Since XAMPP 5.5.30 and 5.6.14, XAMPP ships MariaDB instead of MySQL. However, the name “MySQL” is still used during installation and in the XAMPP Control Panel.

XAMPP also comes bundled with several handy components that make it possible to run a fully fledged hosting environment on your local computer.

In addition to Apache and MariaDB/MySQL, these include:

XAMPP components

  • FileZilla FTP Server: Transfer files from other computers on your local network to the computer running XAMPP.
  • Mercury Mail Server: Enable mail delivery between computers on your local network
  • phpMyAdmin: A visual interface to create and manage your WordPress databases.
  • Webalizer: A handy log analysis tool that generates web pages from access and usage logs
  • Fake Sendmail: A mail forwarder that delivers email to your ISP’s outgoing mail server.

Although you can leave all options enabled during the install, in this blog  how to Setup WordPress using XAMPP on Windows we’ll only be using Apache, MariaDB/MySQL, and phpMyAdmin to install WordPress.

Install XAMPP on Windows

If this is your first time running through this tutorial, the entire process – from downloading XAMPP to logging into the WordPress back-end – should take about 15 minutes. Since you only need to install XAMPP once, subsequent WordPress installations should take about 5 to 7 minutes.

Step 1 - Download XAMPP

Get started by downloading XAMPP from the official XAMPP website. For this tutorial, I downloaded XAMPP 8.0.19. 

Although there is a newer version available (8.1.6), some WordPress plugins aren’t always compatible with the newest versions of PHP.

Step 2 - Run the install

Locate and double-click on the XAMPP installer. Unless you changed your browser’s settings, it should be in your Downloads folder.

1. The User Account Control (UAC) dialog will appear. Click Yes to proceed with the installation.

2. In the screenshot below you’ll see I received a warning about the active UAC on my system. If you receive the same warning, just click OK. We’ll be installing XAMPP to c:\xampp which doesn’t require any special write permissions.

3. Click Next on the initial install screen. You’ll be asked to choose the components you want to install. If you want a lean install, leave only these items checked:

  • Apache
  • MySQL
  • PHP
  • phpMyAdmin

4. Alternatively, if you plan to set up a mail or FTP server down the line, or want to make use of Webalizer or any of the other components, leave them checked.

5. Next, you’ll be asked to confirm the location where XAMPP should be installed. Leave it on the default, c:\xampp. Click Next to choose the language of your XAMPP control panel.

6. When you’re done, click Next until the installation begins.

7. When the installation completes, you’ll be asked whether you want to launch the XAMPP Control Panel. Leave that option checked, and click Finish.

8. Good practice suggests that we test our Apache and MariaDB/MySQL servers by clicking the Start button next to each.

9. A Windows Security Alert might pop up, asking you to allow access for httpd.exe and mysqld.exe respectively. Ensure that the Private networks checkbox is checked and that the Public networks is unchecked.

10 .Click Allow access.

11. When the green status indicates, we’re good to go.

Setup WordPress in XAMPP

Setting up WordPress using XAMPP on Windows provides us with a choice in URL structure:

  • As a subdirectory: http://localhost/mysiterequires less effort to set up, and is useful when you just want a quick and easy way to install WordPress.
  • Or, as a domain: http://mysite.local: useful if you want to proceed with a multisite installation in the future, or if you use plugins like Elementor Pro that allow for unlimited free activations (as long as you have one valid license) in local or development environments.

If you want to setup WordPress with a subdirectory URL structure, skip the step below and continue and create WordPress database.

How to setup WordPress in XAMPP with a domain (Optional)

Since we’re setting up WordPress using XAMPP on Windows as a local installation, you have the option to use any domain name for your WordPress site. However, some plugins won’t take kindly to the use of common top-level domain names (TLDs) such as .com or .net without valid DNS records. As such, it is recommended that you use the .local TLD on your local Windows computer.

Follow these steps to create your .local domain:

Step 1: Edit the Windows hosts file

1. Click on the Windows Start button and type ‘notepad’. It will appear under Apps.

2. Since we want to make changes to a system file, we’ll need to run Notepad with elevated privileges.

3. Right click on the Notepad entry under Apps, and left-click Run as administrator.

4. When Notepad has launched, click on File > Open.

5. Navigate to C: > Windows > System32 > etc > Drivers and open the hosts file.

(Note: The file-type filter in the bottom-right corner of the dialog box must be set to All files (*.*) to see the hosts file.)

On an empty line, add the following:

				
					127.0.0.1   mysite.local
				
			

This maps our local-only domainmysite.local, to our computer’s internal localhost (a.k.a. ‘loopback’) IP address.

6. Save and close the file.

Note: For the remainder of this tutorial, ‘mysite’ will be used as an example only. You can replace ‘mysite’ with your own descriptive name. (Do not use spaces or special characters.)

Step2: Create a virtual host

Now that we’ve told Windows to send all traffic bound for mysite.local to 127.0.0.1, we need to tell Apache to listen for any traffic bound for mysite.local. To do this, we need to create a virtual host entry in Apache’s configuration:

Open Windows Explorer and navigate to c: > xampp > apache > conf > extra, and open httpd-vhosts.conf with a text editor (e.g. Notepad).

Since this is our first time creating virtual hosts, we’ll have to create two virtual hosts: one for our local XAMPP installation, and one for our WordPress site, mysite.local.

Highlight and copy (CTRL+C) the last virtual host entry in the file:

				
					##
 ##ServerAdmin webmaster@dummy-host2.example.com
 ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com"
 ##ServerName dummy-host2.example.com
 ##ErrorLog "logs/dummy-host2.example.com-error.log"
 ##CustomLog "logs/dummy-host2.example.com-access.log" common
##
				
			

Move your cursor to a clean line at the bottom of the file, and paste (CTRL+V). Make changes to the pasted virtual host entry as shown below to ensure XAMPP is always available at http://localhost. Remember to remove the hashes (#).

				
					
 ServerAdmin your-email@local.net
 DocumentRoot "C:/xampp/htdocs"
 ServerName localhost
 ErrorLog "logs/localhost-error.log"
 CustomLog "logs/localhost-access.log" common

				
			

Repeat this process for any WordPress sites you want to configure on your local Windows computer, replacing dummy-host2 with your site details.

Pay attention to the ServerName directive – this is what we’ll type into the address bar to access the website. DocumentRoot is where Apache will look for the files of your WordPress website. Make a note of the name you add after C:/xampp/htdocs/ since we’ll have to create this folder and place all our WordPress files in it.

				
					
 ServerAdmin leo@localhost.net
 DocumentRoot "C:/xampp/htdocs/mysite"
 ServerName mysite.local
 ErrorLog "logs/mysite-error.log"
 CustomLog "logs/mysite-access.log" common

				
			

When you’re done, save and close the file. You’ll need to stop the Apache module in the XAMPP Control Panel, and start it again for changes to take effect.

Create your WordPress database

It’s time to test whether we’ve done every right so far.

A. Open your web browser and type localhost in the address bar. If all’s well, you should see this page:

B. To add, remove, or otherwise manage our databases, we’ll be using phpMyAdmin. Click on phpMyAdmin.

C. In the left hand panel you’ll see a list of databases. These are the system’s default databases. To add our database to the list, click on the Databases tab at the top of the page.

D. Enter the name of your database below ‘Create database’. To avoid problems down the line, database names should consist only of uppercase (A-Z) and/or lowercase (a-z) letters, digits (0-9), and underscores ( _ ).

E. When you’ve entered a name for your database, click Create.

Add a database user

The database we want to manage or make changes to must always be selected before those changes can be made. You can see whether your database is selected in the grey bar at the top of the screen:

When no database is selected, only the local server name is displayed: Server: 127.0.0.1. However, when a database is selected, it will follow the server name: Server: 127.0.0.1 > Database: 

If your database isn’t selected, select it by clicking on the database name in the left-hand panel.

Next, click on the Privileges tab, and then Add user account.

Complete the fields as indicated in the image below. Keep the following in mind:

  • User name: No spaces, no special characters. This is the database user we’ll use to install WordPress, so make a note of it.
  • Host name: Always ‘Local’, always ‘localhost’
  • Generate password: Copy your password to a text file. This is the database password we’ll use to install WordPress. Again, make a note of it.

When you’ve completed all the necessary fields, click Go at the bottom of the page.

Download and extract WordPress

Download the latest version of WordPress from https://wordpress.org/download.

Next, Windows Explorer and navigate to c: > xampp > htdocs.

Create a new folder and give it a name. (If you are installing WordPress with a local domain URL structure, the name you give this folder must be identical to the one specified next to the DocumentRoot directive in httpd-vhosts.conf.)

Return to the Downloads folder and extract the contents of the latest.zip file to your Downloads folder. There should now be a WordPress folder in Downloads.

Open the WordPress folder, highlight all the files and click on the Copy icon.

Open the folder you created in c: > xampp > htdocs. Click on the Paste icon to transfer all the WordPress files, or just press CTRL+V.

Install WordPress

Now that all the heavy lifting is done, it’s time to run through the WordPress installation process. Open your browser and navigate to your site:

  • If you chose a subdirectory URL structure, then enter http://localhost/mysite in your browser’s address bar, where mysite is the name of your WordPress installation folder in C: > xampp > htdocs.
  • If you chose a domain URL structure, enter http://mysite.local in your browser’s address bar, where mysite is is the name you entered next to the ServerName directive in httpd-vhosts.conf.

Choose a language for your WordPress install, and click Continue.

On the next page you’ll be prompted to gather the required credentials WordPress needs during the installation process.

When you’re ready, click the Let’s go! button.

Replace all the default values with the following:

  • Database name: The name you gave your database
  • Database username: The username you added on the Privileges tab
  • Database password: The password you specified for the above username
  • Database host: Leave it on localhost
  • Table prefix: Leave it on the default ‘wp_’

When you’re done, click Submit.

At this point WordPress attempts to establish a database connection using the credentials you entered. If there’s a problem, you’ll receive an error message. If all’s well, you’ll receive the following bit of optimism:

On the next page, you’ll be asked to enter the following information:

  • Site Title: Give your site a descriptive name. It will be displayed in your browser’s title bar. On production websites, the site title is displayed in a search result’s heading.
  • Username: Make a note of the username you enter here since you’ll need it to log into WordPress.
  • Password: Ditto.
  • Your Email: Whether or not you have a local mail server up and running, WordPress still requires an email address.

When you’re done, click Install WordPress.

Success! You’ve setup WordPress using XAMPP on Windows. Click on Log in to log into the WordPress back-end.

Troubleshooting: Apache fails to start

In some cases Windows comes installed with Internet Information Services (IIS).

IIS is the equivalent of Apache, and listens for browser requests on the same port. Given that only one of these services can actively listen on a port at any given time, you might receive an error message when attempting to start Apache in the XAMPP Control Panel.

To resolve this error, you will need to deactivate IIS:

Click on the Start button. 

Start typing “Turn Windows features on or off” and select the Control Panel item of the same name.

Deselect Internet Information Services and click OK.

Great job with reading the article how to Setup WordPress using XAMPP on Windows until the very end. Let’s summarize.

How to Setup WordPress using XAMPP on Windows Conclusion

XAMPP Stack based solution is great for developing WordPress websites on your computer. The entire setup process is quite straightforward and once you have everything installed, you can create posts, pages on your WordPress website.

Avatar for Leo De Jager
Leo De Jager

I'm a freelance writer in the tech industry. When I'm not writing about hosting-related topics, I spend my time doing calisthenics or in the ocean doing my level best to stand on a surfboard.

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x