Setting Up WordPress Locally for PC/Windows with WampServer

Setting Up WordPress Locally for PC/Windows with WampServer

Having WordPress set up as a localhost on my computer has become invaluable to my workflow, particularly as I regularly test themes and plugins.

My local sites run much faster, plus testing products on my local machine is much safer than testing on a live site – not to mention much cheaper without the cost of web hosting.

Setting up a local server environment for WordPress isn’t difficult and will save you time in the long run since you won’t have to install and uninstall a fresh copy of WordPress online each time you test or develop something for WordPress.

There are many options for Windows. I’ve previously looked at how to set up a localhost using XAMPP. In this tutorial I’ll walk you through how to set up WampServer, including installation, creating a MySQL database, and installing WordPress. I’ve included optional steps for setting up Multisite.

What is WampServer?

WampServer is a popular Windows web development environment that allows you to create web applications with Apache2, PHP and a MySQL database.

WordPress isn’t a stand-alone application and needs server software to run. WampServer provides the necessary server environment so you can install and run WordPress on your local machine rather than on the internet.

Installing WampServer

Head over to the WampServer site and download the latest version of the software. WampServer is an open source project and is free to use.

WampServer site
The WampServer site.

The WampServer site offers two versions of the software – 32 BITS or 64 BITS. Click on the version you prefer.

A warning message will display. Click on “download directly,” and you’ll be taken to the SourceForge website. The download will automatically start in 5 seconds.

The WampServer executable file is small at just 41.5MB, compared to XAMPP, which is 125MB.

You may receive warnings about installing the software on your computer. As you would when installing any software on Windows, use your best judgment, though it’s best to ignore the warnings if you want the installation to continue.

The WampServer setup wizard will guide you through the installation.

WampServer installation
WampServer setup wizard.

The next window will ask you to agree with the software’s terms and conditions. Check “I accept the agreement” and click “Next.”

Terms and conditions
WampServer terms and conditions

Next, select where you would like to install the software and click “Next.” The default is c:\wamp, which I’m going to use for this tutorial.

Installation location
Choose a location for the software on your local machine.

In the next window, you can choose to create shortcuts so you can quickly and easily access WampServer on your computer. I’m not going to create any for this tutorial.

Icons
Create shortcuts for WampServer.

The software is now ready to install, so go ahead and click “Install.”

Install WampServer
Ready to finish installing WampServer.

Once installed, you may be prompted to choose your default browser. In my case, I chose Google Chrome.

You’ll then be prompted again to specify the SMTP server and the email address to be used by PHP. These settings aren’t all that important, so just leave the defaults and click “Next.”

Mail setup
Fill in your details or just leave the defaults.

Installation is now complete! Click “Finish” and the software will launch.

WampServer ready
WampServer is now ready to use.

Check WampServer is Running

If you click “Finish” and the software doesn’t launch and you run into any errors, it might be thatyou don’t have the Microsoft Visual C++ libraries installed on your computer. Apache and PHP won’t run without them.

For Windows 32BIT: Install the Visual C++ 2010 SP1 Redistributable Package x86 : VC10 SP1 vcredist_x86.exe

For Windows 64BIT: Install the Visual C++ 2010 SP1 Redistributable Package x64 : VC10 SP1 vcredist_x64.exe

Depending on your local machine, you may have to install one or both of these files. If WampServer still doesn’t work, trying installing Visual C++ Redistributable for Visual Studio 2012 Update 4.

If you continue to have any issues, check out the WampServer forums.

If any security warnings pop up, such as firewall warnings, be sure to allow access otherwise the software won’t work.

If you click “Finish” and the software does launch, a WampServer icon will appear in the systems tray.

System tray
A green WampServer icon means your servers are running.

The color of the WampServer icon allows you to quickly determine the status of your servers.

  1. If the icon is red, the server isn’t running and is offline. You may need to restart WampServer or check out the WampServer forums for more help.
  2. If it is orange, the server is partially running, i.e. Apache may be running and the MySQL service is offline. Click on the WampServer icon and check the service status next to Apache and MySQL to see if they are running. You may need to restart WampServer, and if it still doesn’t work, check out the WampServer forums.
  3. If the icon is green, it means the server is running and you should be able to access localhost from your browser.

To test it, go to “localhost” in your browser.

Localhost
Check that localhost is working by typing “localhost” into your browser.

Setting Up Your MySQL Database

Before we install WordPress, we need a database.

Click on the WampServer icon in your system tray and then click on phpMyAdmin.

phpMyAdmin
Let’s create a new database for your WordPress install.

A new browser window will automatically open with the phpMyAdmin interface.

XAMPP phpMyAdmin
Click “phpMyAdmin” or go to “localhost/phpmyadmin” in your browser.

Click on “Databases” near the top-left and you’ll be prompted to create a new database. I’ve called mine “WP”.

When you’ve entered a name, click “Create” and close the window.

XAMPP MySQL database
Quickly and easily set up a new MySQL database for WordPress.

Download and Install WordPress

Download the latest version of WordPress.

In order to get WordPress working with WampServer you need to unzip WordPress to the right folder. Extract WordPress to the C:/wamp/www/ folder.

You can rename the WordPress folder whatever you like. I’m going to keep it as “wordpress.”

WordPress
Extract the latest version of WordPress to the “www “folder in “wamp.”

Next, open your WordPress 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:

wp-config database details
Update your wp-config.php file with your database details.

These lines of code define the login details for your database. Replace “database_name_here” with the name of your database, which in my case is “WP.”

Replace “username_here” with “root” and leave “password_here” blank.

Save the file and close it.

Now we can get on with installing WordPress.

Open your browser and go to http://localhost/wordpress/

You should see the welcome screen for the famous five minute WordPress installation process.

Famous five minute install
Set up WordPress using the famous five minute install process.

Enter your details and click “Install WordPress.”

Your WordPress installation is now complete!

Setting up WordPress Multisite

Setting up Multisite on a localhost provides a quick and easy way to test/develop themes and plugins away from a live site.

Open your wp-config.php file again and add/edit the following lines to activate Multisite’s installation mode:

Activate Multisite
Activate Multisite installation mode.

Click on the WampServer icon in your system tray and ensure your Apache and MySQL servers are running.

Login to your localhost site in your browser and under “Tools” you will now have a new option, “Network Setup.”

Network setup
Enabling Multisite will add a new “Network Setup” sub-menu item to WordPress.

Enter a name for your network and your email address, then click “Install.”

WordPress will prompt you to edit your wp-config.php and .htaccess files.

Following the onscreen instructions, open wp-config.php and add the following lines underneath your previous edit:

Multsite wp-config
Edit your wp-config file to get Multisite up and running.

Next, open .htaccess. If you can’t find it, make sure hidden files are displaying on your computer.

Your .htaccess file should look like this:

Edit .htaccess

Edit your .htaccess file to complete your Multisite installation.

Multisite should now be enabled and working on your WordPress site!

Multisite network
Your Multisite network should now be up and running!

Summing Up

WampServer offers a relatively easy way to run a local server environment on your Windows machine, allowing you to test and develop locally rather than online.

Running WordPress locally will save you a lot of time since you won’t have to install and uninstall a fresh copy of WordPress each time you test themes and plugins with your web host.

While WampServer is free and open source software, it’s easy to run into trouble setting it up on Windows. While putting this tutorial together I ran into a bunch of issues trying to get Apache working. XAMPP is relatively easier to setup and I would recommend that as a more reliable alternative.

Overall, setting up a server environment is relatively painless and something I would recommend to any WordPress developer or hacker.

Raelene Morey
Do you use WampServer? Tell us in the comments below.