Install WordPress on Your Computer Using WampServer

Nov 5 2010 by Mark Biegel | 49 Comments

Install WordPress on Your Computer Using WampServer

What is WampServer? WampServer is an easy to use web server package that allows you to configure Apache, MySQL and PHP in your local machine to match that of your live web server. It’s free to download, and since WampServer installs quickly and easily, it’s very user-friendly even for those who are not familiar with server administration and server management.

Why would you want to set up a web server on your computer? Best practices dictate that you should never do on-the-fly updates on a website that is in production (i.e. websites that are already up online and are being used by your site visitors) without first testing it either offline or on another remote web server.

Install WordPress on Your Computer Using WampServer

Having a web server in your computer means that you can test your work and perform web development tasks offline, not only making it convenient for times when you don’t have internet access, but also ensures that your site upgrades won’t unexpectedly cause major downtimes when you update your site.

Furthermore, you can develop new PHP/MySQL applications offline without having to spend any money on domain names and web hosting; you can just spend your hard-earned dough after you finish your app!

This guide covers the installation and configuration of WordPress on your personal computer using WampServer.

Objectives

In this guide, you will install and set up WampServer, set up a website, and manage your MySQL database.

As a working example, we will use WordPress, an open source publishing platform that uses PHP and MySQL. However, the steps for installing any PHP/MySQL project or creating your own PHP/MySQL apps will be very similar, so even if you’re working with Drupal, Magento, Joomla!, or a custom app, this guide will still be useful to you.

We will also cover how to sync our local website files with our live production server so that once we are done with our offline work, we can quickly and easily commit them to our live website.

Here is what we will cover and do in this WampServer guide:

  1. Download and install WampServer
  2. How to use your local (localhost) web server
  3. Set up WordPress
  4. Set up PHP configuration settings
  5. Manage the local website
  6. Managing the local MySQL database
  7. Syncing your local files with a live server using FTP
  8. Syncing your MySQL database with a live server using MySQL export/import

Let’s get started, shall we?

Download and Install WampServer

First, get yourself a copy of WampServer by visiting the WampServer download page found at the following URL:

At the time of writing this guide, WampServer 2.0i is the latest version and the one you will want to download. By downloading WampServer 2.0i, you will be installing the following:

  • Apache 2.2.11 (the web server application)
  • PHP 5.3.0
  • MySQL 5.1.36
  • phpMyAdmin (a convenient web interface for managing our database)

When you download WampServer from the URL provided above, you will be taken to SourceForge to download WampServer.

Once downloaded, run the installer.

Click Next past the first screen and agree to the license agreement.

Download and Install WampServer

Choose your installation directory. The default is c:\wamp — I would recommend using the default location to avoid any potential issues.

Download and Install WampServer

In the Select Additional Tasks dialog, you can choose if you would like to have a Quick Launch icon and a Desktop icon so that you can quickly open WampServer once it has been installed.

Download and Install WampServer

The final screen before the installation process is a recap of your installation options. If you’re happy with it, just click Install.

Download and Install WampServer

During the installation process, you will be asked to set your mail() settings, which is a PHP function that deals with sending emails from a PHP app. I left mine at the default settings.

Note: Getting the mail() function to work correctly in a local environment is often tricky, so don’t get surprised if mailing functions don’t work!

All done? You can click Finish to launch WampServer.

Upon successful installation, you will now notice a new icon in your taskbar that looks like this:

Using Your Localhost Web Server

The first thing we should do is check to see if WampServer is installed properly. Open up your web browser and navigate to http://localhost.

If WampServer is turned on and is working properly, you will be looking at the default Server Configuration page.

Using Your Localhost Web Server

On the Server Configuration page, you will see what extensions are installed, some basic tools for managing your localhost web server, your existing projects, and the phpmyadmin link (which we will use later on).

Create a Directory for Your Website Files

I have already created a directory for my website files (which is called a project in WampServer).

All you have to do to create a project is simply make a folder inside C:\wamp\www. I called my directory, website — and thus, the project is called website as well. Next time we go to http://localhost, that project will be listed under Your Projects.

To navigate to our project directly, we can use http://localhost/website, where website is the name of the folder we made. For example, if you create a folder called foo, then we go to that project by going to http://localhost/foo.

Setting Up WordPress

To get the ball rolling, we are going to quickly set up a WordPress site in our localhost web server.

First, download WordPress.

Once downloaded, extract the WordPress files to your newly created c:\wamp\www\website folder.

Creating the WordPress MySQL Database

First, you should create your WordPress database on your live production server as sometimes a webhost will give your database a prefix name automatically (e.g. db01_wp_mydatabasename). If you have full control of the naming conventions of your MySQL databases in your live production server, then don’t worry about this.

If you already have a WordPress database in your live production server, name your localhost web server’s WordPress database the same name.

Instead of dealing with the command line, we will use phpMyAdmin, which is a GUI that runs in your web browser that will easily help you manage your MySQL databases.

We need to navigate back to http://localhost and then click on the phpmyadmin link towards the bottom of the Server Configuration screen, under Your Aliases.

Once phpMyAdmin launches, create a new database with the same name as your live setup. Here, I just called my database wordpress, but I advise you to name it something else so that you reduce the chances of a successful bruteforce MySQL attack.

Creating the WordPress MySQL Database

Install WordPress

Now browse to http://localhost/website and follow the prompts to set up WordPress.

When you get to the database screen, we will be setting the MySQL username to root and we won’t set a password. We are using these details because we have not set up any users in our localhost MySQL database yet.

Install WordPress

If the database is created successfully, you will be prompted to continue the installation. Just click Run the install to install WordPress on your localhost web server.

Install WordPress

If everything goes according to plan, you’ll see the Success! screen. Excellent, everything is now set up for WordPress.

Install WordPress

To confirm that WordPress has been installed successfully in your localhost web server, check that your WordPress database tables are present in your WordPress database by going back to phpMyAdmin.

Install WordPress

Set Your PHP Configuration Settings

Because we are wanting to make our localhost web server 100% compatible with our live production web server, we should make sure our PHP config file (php.ini) is the same as our live server. This is a best practice to ensure that what we are looking at when we are developing stuff on our computer is going to work exactly the same when we commit our files to the live production web server.

If you don’t have access to your php.ini file (which is typical in shared hosting), you can create a PHP file in your live production web server that has the following PHP function in it:

<?php
phpinfo();
?>

Once done, navigate to that file in your web browser, and you will be presented with information regarding PHP configuration settings in your web host.

Set Your PHP Configuration Settings

This can be a tedious task, but you want to make sure that the settings match. Not everything needs to match exactly and I have found that in most cases, it is only necessary to make sure safe_mode is set, magic_quotes_gpc is set and try to match the PHP version if you can.

Note: If you have a different PHP version on your live server, you could install that version on WampServer because, unless you run a VPS or a dedicated server, you won’t be able to update your web host’s PHP version. However, I should recommend that you should be using PHP 5 (the latest version); if your webhost is running PHP 4 (or lower) and doesn’t have the option for PHP 5 — it’s time to consider switching to another host.

Common WampServer Administration Tasks

There are a bunch of other things we can do to customize our localhost web server. Here are a few common tasks that you might want to perform.

Enable Apache’s mod_rewrite

If you are wanting to use pretty URLs (i.e. http://localhost/website/blog-post instead of http://localhost/website/?p=132), you will need to enable the Apache mod_rewrite module.

To enable mod_rewrite, click on the WampServer icon in the taskbar, mouse over Apache and then Apache modules. Find rewrite_module in the list and click it. You will need to then click Restart all services to start using mod_rewrite.

Enable Apache's mod_rewrite

Creating New MySQL Users

To make everything easier, we will create a MySQL user with the same details as our live server’s WordPress MySQL user. Browse to http://localhost/phpmyadmin again and click on your WordPress database to select it (you only have one database so this should be easy).

Next, click on the Privileges tab at the top of the screen, and then click Add a new User.

Creating New MySQL Users

I gave my new user the same name and password as my live MySQL user. I also set my user for any host. For my localhost database, I am safe to click the Check All option at the bottom, which grants my new MySQL user all privileges for my WordPress database. However, on a live production server, you should minimize the amount of privileges you give your MySQL users to improve security.

Creating New MySQL Users

Configuring the WordPress Install to Match the Live Server

We will edit our WordPress config file (wp-config.php) to match the new database details. For other websites that are not running WordPress, the process will be much the same.

Configuring the WordPress Install to Match the Live Server

This has been a long setup process so far, but what you have now is a local website that has the same configuration as your live server.

Whenever you want to add another website, it is as simple as creating another folder in your c:\wamp\www folder.

Syncing Your Websites

Syncing your website files is quite easy. With all the settings the same as your live website, FTP is the best option.

You might be thinking, what about direct file paths though? As long as you have used relative paths to set your document root where needed, then you will be all set.

Exporting MySQL Databases

When it comes to your database, you have a few options. The easiest option is to just use phpMyAdmin and export your database into a ZIP file or a SQL file, then import it into your live production server.

To do this, first browse to http://localhost/phpmyadmin and select your WordPress database.

In the top menu, click th Export tab.

On the Export screen, you have several options. At the top of the screen, you will see the Export section. This is where you will select what tables you want to export. Beside this section is the Options section. I have found that phpMyAdmin has all the settings needed already set by default.

Exporting MySQL Databases

The main area to look at is the Data options. If you require the data on your local database to be imported on the live server, then tick this box. If you don’t, only an empty table will be created.

While it is possible to export all the data and structure at once for the entire database, I recommend only updating what has changed in the database. This is especially important with active websites that allow users to write data (such as WordPress) as you don’t want their data overwritten or lost.

A good rule is to always replicate data from your live website to your local development website, but only send the changed structural data back. Also, back up your live database before any changes.

Importing MySQL Databases

Most web hosts will have phpMyAdmin available to you. To import the data to the live site, access phpMyAdmin and select your database. In the top menu next to the Export link, there will be the Import tab. Before you do anything, you should backup your database first!

Importing a MySQL database on a live site is very straightforward. Browse for your ZIP file or SQL file that you should have somewhere in your computer from the export process above. Make sure the option for Partial Import is selected, as this will cater to any timeout issues if you have a large database. Then just click the Go button towards the bottom of the screen.

Importing MySQL Databases

If all goes well, you will have updated your database. If anything is not right, simply restore you backup and determine what the issue was before retrying the import process.

Conclusion

No matter what your needs are, setting up a localhost web server is a useful and safe measure to take. I would also try to set up a live dev site when working with a client website before pushing any major updates so that you can be doubly sure that your changes are safe in the actual production environment.

Take the time to set up your development environments and make this part of your web development process. If you do, you will never have that moment where tragically, live data is lost or a website is down for hours/days because of an erroneous development foul-up on a live website.

Related Content

About the Author

Mark Biegel is a Web Designer and Programmer from Brisbane, Australia. Specializing in PHP, HTML, CSS, JavaScript, as well as design, he has been riding the highs and lows of the web industry for the last 10 years. You can find out more about Mark’s various projects at markbiegel.com and connect with him on Twitter.

49 Comments

Dainis Graveris

November 5th, 2010

Great post! Aside from the super in-depth guide, people can actually understand why it is so important to install a localhost web server instead of directly uploading a whole project online. I salute you for providing a really good guide, no one would be lost in the woods while, and after, reading this. Hoping to see more in the future.

George Mamadashvili

November 5th, 2010

Hello, nice tutorial. Now I’m using XAMPP on my computer, is there big difference between XAMPP and WAMP?

Brow

November 5th, 2010

Very good article. I love using wamp as it just makes life much easier to test wp plugins and themes locally. If I mess things up, its just a quick and easy re-install and then I am back in business.

John Garrett

November 5th, 2010

I use MAMP on the Mac, but I’m going to send this to a friend of mine working on Windows. I’ve been after him to start being more careful with changes to his site (since I end up fixing his screw-ups :P)

But I hadn’t gotten around to digging into Wamp or Xampp to help him out. This is just what the doctor ordered.

I love using Mamp with my WP and Joomla sites to test and then “push” out changes to my live site. Can’t remember how I got along before I started using local test servers.

Great article, thanks!

dloop

November 5th, 2010

support for tomcat for writing jsp? xampp provides a tomcat plugin. i’d love to try this, but seems there’s no love for a mac. =(

William

November 5th, 2010

Good tutorial. I will like to know how to set up a live dev site.

Stefan

November 5th, 2010

Realy great post!
If you are on a Mac you can use MAMP. A similar solution as WAMP.

Stefan

November 5th, 2010

Oops!
John Garret was faster than me mention the MAMP. :-)

Jeff Woodruff

November 5th, 2010

Very nice article! I was actually thinking about documenting the process myself but it looks like you got it laid out perfectly. I’ve got my dev system setup using WAMP and a WordPress multi-site config which is great for managing multiple client themes in one place. And as you pointed out, it’s always good to have a local dev environment.

Jacob Gube

November 5th, 2010

Just to add to the MAMP suggestions, you could also use XAMMP, which is cross-platform (Linux, Windows, Mac OS). Good solution if you use multiple operating systems and just want one server package to work with instead of working with WampServer on your Windows PC, MAMP on your Mac, etc. I wrote a similar guide on installing WordPress on XAMMP.

@George Mamadashvili: They both work the same way. However, after playing around with WampServer (inspired by this guide by Mark as well as positive comments by SR readers regarding WampServer), I’ve personally switched to WampServer.

George Mamadashvili

November 5th, 2010

@Jacob Gube: Thanks I’ll try WAMP too. It would be great if there was something similar to MAMP Pro on Windows

Dustin Dyer

November 5th, 2010

great article. I have no idea why anyone would use anything else. I have mamp on my mac. wouldn’t have it any other way.

Usi

November 5th, 2010

oh man this is really amazing, Believe I was just searching some days ago to make my pc an offline server for me.

but I found some online methods which are too complicated, but this software is really amazing..

thanks for this share friend really thanks.

Red

November 5th, 2010

Very comprehensive article!

I usually use XAMPP or EeasyPHP for localhost projects.

Mark

November 5th, 2010

I have used xammp also and do like it. For me, running wamp on windows 7 was fast and reliable while xammp had some issues with resource hogging. Not sure if anyone else found this? Wampserver for me is more of a complete package rather than individual components.

Young

November 5th, 2010

@Jacob well what made you switch over?

Marcell

November 5th, 2010

I’ve never seen MAMP. I;ve always used XAMPP but this looks the same. The only problem with me and local severs on windows base pc’s are not being able to CMD files other then that its pretty good. Nice tutorial very in depth.

Jacob Gube

November 6th, 2010

@Young: I knew someone would ask that eventually. I rushed my first comment and didn’t really say why. First, the user interface is more convenient. You just go to root, and you have tons of options and helpers. The taskbar icon in WampServer is super charged; it’s got lot of options right there. With XAMMP, there is no interface to enable Apache modules. With WampServer, as shown above, it’s pretty easy. Lots of other little things.

Vlajki

November 6th, 2010

Thank you very much :) It works perfectly!

Ben

November 8th, 2010

Why didn’t this tutorial exist a few weeks ago!! ;)
WAMPserver is a great product

bbcversus

November 8th, 2010

Thanks alot for sharing! I will put WampServer to good use these days!

Monie

November 8th, 2010

I’ve talked on details configuration like setting up your PreetyURLs in your .htaccess, setting up your FTP account and setting up your MySQL password in my personal blog here!

Graham

November 9th, 2010

I recently came across The Uniform Server (http://wiki.uniformserver.com/index.php/Main_Page) with a view to using it for creating a WordPress site to be later uploaded to a host. With the positive comments above for Wampserver, I now have a dilemma as to which I should use. I am a novice at webdevelopment/blog/WordPress/code so I need something very simple and straightforward. Could any of the learned contributors to Six Revisions give me some advice. From the above comments, I am leaning strongly towards Wampserver.

hkarthi

November 9th, 2010

Cool post! Its nice to see the tutorial with good, understandable screenshots to explain the process. Good work!

Carl Bertossi

November 11th, 2010

Hi,

This programs works for all blog or just for this one what you have to pay ?
I have one blog on wordpres.com and thing is I want change Layout because so many people have this same one and I don’t now any thing abut blog stuff, like how to get readers ?
Well I have try :)

Thanks Great post, comments

Mark

November 11th, 2010

It will work with any website at all. And its free.

everlearner

November 12th, 2010

Thanks you Mark Biegel.

It will be nice to read if you can write a follow up article “How to recover when a WAMP server on localhost crash down?”

I got an experience with a crashed WAMP server in my office job. I can’t reinstall anymore, even though I totally remove all the installation using Revo Uninstaller.

After that I switched to XAMPP and tweak the PHP memory limit, max upload limits etc. One good thing of XAMPP is, we can use Mercury email server for localhost. I still love and using WAMP in my home PC and Laptop because of its easy to use features.

Chris of Arabia

November 13th, 2010

@Graham: I’ve used both WAMP Server (mostly) and have recently taken a look at The Uniform Server. For me there is very little difference in terms of capabilities, they both provide Apache, MySQL, PHP5 and phpMyAdmin, which is pretty much all you need to trial WordPress or others locally. The only real differences that I’m aware of are:

1. The Uniform Server provides more recent versions of the main components, where WAMP is now over 12 months old.
2. The Uniform Server can be run directly off a memory stick without having to install it on your PC
3. They have their own front-end management GUI

Personally I can use either, but am leaning towards The Uniform Server because it’s being kept up to date.

J.

November 16th, 2010

For a different flavour (it depends on what you’d need) you can use Bitnami Stacks (they are free). http://bitnami.org/stacks . You have there WAMPStack, MAMPStack, LAMPStack, etc (for Windows, OSX, Linux..) which you can use as infrastructure to install the “stacks” (applications, also free), For example wordpress stack. You can even install as usual(native), as VM or in the cloud.

Cape Verde

January 9th, 2011

I am grateful for the information here. I have had problems with Lamp on Ubuntu and so now have an opportunity to ramp up my old XP dual boot with Wamp and see if those problems go away. Thank you.

Ben

January 10th, 2011

i have tried to install the WAMP 2.01 on my locall disk but it does not load up after installation..I click on the quick launch phpmyadmin but inturn it says link broken on the browser…! Help

indu

February 7th, 2011

Hi
Its Really good work :-)
thanks a lot

gdogg

May 2nd, 2011

buddpress.. activity, members, groups

Oops! This link appears to be broken.

Aneeza Mubbashir

May 12th, 2011

It will work with any website at all. And its free.

Camila

June 5th, 2011

So, I have installed WAMP 3 times and I cannot access the control panel, whenever I type in http://localhost on my browser window a simple page with the word “it works!” appears…and your tutorial didn’t bring anything on how to solve this problem…any ideas?

Jason

June 22nd, 2011

Mark,

First off, thanks for the article. I was really easy to get things up and going. My only question now is for every WordPress site that I want to build locally, I know I have to just add another folder under www but I also need to install wordpress to that folder? Thanks

Chris

August 19th, 2011

Awesome tutorial Mark! Clean, simple, straight to the point, and best of all, it worked for me. I’ve been having challenges with ports and such with Xampp. This worked without a hitch and can’t wait to see how the uploading to the live site works. Thanks so much for your time prepping this!

Malene

September 13th, 2011

Please help me!

I’m stuck at “Set Your PHP Configuration Settings”. What is it exactly that i have to do? As in step by step. Not really too good at computers… (mail: [EMAIL REMOVED FOR PRIVACY])

Marja

October 5th, 2011

I have been using xamp for quite a while now, but I’ll give this a try now.
The problem I0ve been having is that I want a subdomain network on my local setup to mimick my live setup. When I try this I get the message that I should install in localhost.localdomain instead of localhost.

Can anyone tell me how I do this?

mila

October 31st, 2011

I’am at the mysql part. If I click on phpmyadmin I get the message: ‘Forbidden

You don’t have permission to access /phpmyadmin/ on this server.’

What’s wrong??

Marieke Bier

November 2nd, 2011

Thank you so much for this wonderful article. I was feeling pretty intimidated by the whole wamp/sql server bits… got it up and running! whoo hoo

Marieke Bier

November 2nd, 2011

Thank you for this article. I was feeling a little intimidated about creating a database, and having it all work… and it does!! Yeah!

shambhu

November 8th, 2011

Very nice article and i learnt co many thing from this. Thank you so much

Craig

November 14th, 2011

Very good mate there is a lot of posts out there that were were terrible. Thanks again

Francois

October 8th, 2012

Great Post! I love how in depth you go.

Kavitha

May 28th, 2013

I was having trouble installing wordpress now its all clear after reading your post that all i had to do was to create a database with the same name as my username for wordpress …. thank you so much :)

Andres Garcia

June 27th, 2013

Check out http://www.zipidoo.com/. You can share your local development environment and even have someone else update your WordPress content from different computers or locations! No more pushing to a public web server somewhere just to show someone your progress.

Ed

December 27th, 2013

Hi,

while searching for an answer I came across this site that give a good account of the database at the live site and the local dev site.

I have a problem. I started of with different database name, username and password at both the live and the development site. Now having completed my project and I
discovered a problem exporting it to the live site. Error showing something is not correct with my database and user name.

what is the solution to this.

Leave a Comment

Subscribe to the comments on this article.