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.
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.
The next window will ask you to agree with the software’s terms and conditions. Check “I accept the agreement” and click “Next.”
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.
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.
The software is now ready to install, so go ahead and click “Install.”
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.”
Installation is now complete! Click “Finish” and the software will launch.
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.
The color of the WampServer icon allows you to quickly determine the status of your servers.
- 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.
- 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.
- 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.
1.6 million WordPress Superheroes read and trust our blog. Join them and get daily posts delivered to your inbox - free!
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.
A new browser window will automatically open with the phpMyAdmin interface.
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.
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.”
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:
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.
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:
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.”
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:
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 your .htaccess file to complete your Multisite installation.
Multisite should now be enabled and working on your WordPress site!
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.