Installing WordPress on the XAMPP Stack

Whether you are a WordPress developer, site-administrator, or blogger, it’s very useful to have access to a local environment for code development, testing, and training. In such an environment, you can test new WordPress updates, themes, plug-ins, and configuration changes prior to migrating those changes to your live production environment. In the article Installing XAMPP on Windows, I provided instructions for installing the XAMPP stack on a Windows development machine. In this article, I’ll provide step-by-step instructions for installing and configuring a local WordPress environment on the XAMPP stack.

Note: You can click on any of the images in this article to see a full-size version.

Downloading and Installing WordPress

The first step is to download the WordPress software. Using your favorite browser navigate to as shown below. Click the Download WordPress 3.5.1 button.

The makes it easy to download WordPress

This link takes you to the download page where you can download a .zip or a .tar.gz file. Since I’m installing on Windows, I will choose the .zip version. However, if you’re installing on Linux or Unix you will probably want the .tar.gz version.

WordPress Download Page

The WordPress Download page provides two different download formats

Next, you need to decide what URL you would like to use to access WordPress as this will determine where the zip file contents should be extracted. You may want to just install WordPress directly in your document root. There, it will be accessible with the URL http://localhost. Alternatively, you might want to install it in a folder beneath the document root, such as htdocs\wordpress where it will be accessible with the URL http://localhost/wordpress. My objective is to have multiple “lab” environments available for development and testing purposes so I will install WordPress in the directory htdocs\lab1. This affords me the opportunity to create additional environments in the future (e.g. lab2, lab3, etc.), each with an independent copy of WordPress. In this case WordPress will be accessible using the URL http://localhost/lab1.

I’ll first create a new directory beneath the web server’s document root called lab1. My document root is at g:\xampp\htdocs, so I end up with a target directory of g:\xampp\htdocs\lab1. To extract the zip file I’ll use WinZip. First, select all of the files in the zip’s wordpress directory as shown below.

Distribution Zip File Contents

The WordPress distribution zip file includes a wordpress directory

Then, change the extract location to your target directory. Finally, click the Unzip button to extract the files.

Set Extract Destination

Change the target destination prior to extracting the zip file

Ensure that the WordPress distribution files and sub-directories are extracted directly into the lab1 directory as shown below.

WordPress Installation Directory

The installation directory should contain all of the files and sub-directories from the distribution zip

Creating the MySQL User and Database

Next, you will create a new MySQL database to contain your WordPress database objects. You can use either the MySQL Client or phpMyAdmin to perform this task. We’ll choose the latter for this article. Using your local browser, navigate to the URL http://localhost/phpmyadmin. You should see the phpMyAdmin apllication as shown below.

phpMyAdmin Page

The phpMyAdmin application allows you to manage your MySQL databases

In a production environment you would probably want to create your database and a user to access it in two separate steps. In this way you can give the database and user different, hard-to-guess names. But for a development environment such as this, you can save a little time and create a database and user in one step. Select the Users tab and click Add user as shown below.

phpMyAdmin Users Overview Page

The phpMyAdmin Users Overview page allows you to create new MySQL users

Enter lab1 into the User name field (beside the Use text field drop-down). Next to the Host field, select Local from the drop-down list (this will automatically enter localhost in the text box). Enter a password in the Password field and re-type it in the Re-Type field. Check the box next to Create database with same name and grant all privileges. Now click the Add user button.

phpMyAdmin Add User Dialog

In the phpMyAdmin Add User dialog you enter user information and can optionally create a database with the same name

You will see a brief message indicating that the user was created and you’ll then be returned to the Users overview page where should see your new lab1 user.

phpMyAdmin User Overview Page

The lab1 user has been successfully created

Also click on the Databases tab to ensure that the associated database lab1 was also created successfully.

phpMyAdmin Databases Page

The lab1 database has been created successfully

Configuring WordPress

You now need to configure WordPress so it can access your MySQL database. You can either create/edit the file wp-config.php yourself using a text editor or let the WordPress installation script prompt you for the information. We’ll choose the latter approach. Using your browser, enter the URL http://localhost/lab1. WordPress provides you with the helpful message shown below. Click the button Create a Configuration File.

Create Configuration File Dialog

The WordPress installation script notifies you that there’s no configuration file and prompts you to create one

You are next presented with an explanation of the information you will need to complete the setup process. Click Let’s go!

:et's Go

A summary of needed information is provided before continuing with the installation

Now enter the Database Name, User Name, and Password in the fields provided. Leave the Database Host as localhost. The table prefix is a string that will prefix the table names created in your MySQL database. If you want to create multiple sets of WordPress tables in the same MySQL database (for different instances of WordPress) you can set this prefix to a different value for each. In this case, leave it at its default value of wp. Click Submit.

Database Information Dialog

Provide details for the MySQL database that WordPress should use for this installation

If your database information was entered correctly, you should see the message below. Click Run the install.

Run The Install

The database can be accessed and WordPress is ready to begin the installation

You can now enter some basic configuration information such as your Site Title, administrator Username and Password, your Email Address, and Search Engine Privacy Setting. Once you’re satisfied with the settings click Install WordPress.

Site Information Page

Enter some basic site information including your administrator username

Finally, you should see the Success! message below. Click Log In.

Installation Success Page

The installation was successful and you can log in to the WordPress Dashboard

Checking Your WordPress Installation

You should see the sign-in screen below. Enter your administrator Username and Password in the fields provided and click Log In.

WordPress Log In Dialog

WordPress prompts for your username and password

You will now be taken to the Dashboard for your site.

WordPress Dashboard

The WordPress Dashboard allows you to configure your site

Since installing WordPress on XAMPP is such an easy process, you should definitely have a local development environment available where you can experiment with changes to your site prior to making them in your production environment. This environment will function even when disconnected from the internet. Of course, to install new themes and plugins you must be connected, but once installed, most will continue to function when disconnected.

In future posts, we’ll use this baseline environment to explore WordPress in depth.

Speak Your Mind