Setting up a WordPress development environment with WAMP

By Aldert Vaandering

May 31, 2013

Making changes to live environments without testing them out first is risky and sooner or later will take out your (or even worse, someone else’s) website, until you fix what you broke! Therefore it’s important to setup a development environment locally. In this post I will explain how to do this easily using WAMP.

What you will need:

  • WAMP running versions similar to what your live site is running
  • A backup of the files
  • A backup of your database
  • Let’s begin, shall we?

First let’s install WAMP. This will allow us to locally host everything that’s necessary for WordPress to run. This is really as simple as opening the installer and clicking next.

Now that WAMP is installed we will have to configure some settings to make it work.

Open .\WAMP\bin\apache\apache *.*.*\conf\httpd.conf Look for Listen 0.0.0.0:80 and change it to Listen *:80 Look for #Include conf/extra/httpd-vhosts.conf and uncomment it (remove the #)

Open .\WAMP\bin\apache\apache *.*.*\conf\extra\httpd-vhosts.conf Remove everything below the example and add the following instead:

    <VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot "##YOUR WAMP ROOT DIR##\www"
        ServerName localhost
        ErrorLog "logs/localhost-error.log"
        CustomLog "logs/localhost-access.log" common
        <Directory "##YOUR WAMP ROOT DIR##\www">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order Deny,Allow
            Deny from All
            Allow from 127.0.0.1
            Allow from ::1
        </Directory>
    </VirtualHost>
    <VirtualHost *:80>
        DocumentRoot "##DIRECTORY OF YOUR WEBSITE BACKUP## (example: D:\Work\Web Development\Websites\AldertVaandering.com)"
        ServerName dev.aldertvaandering.com
        ServerAlias dev.aldertvaandering
        ErrorLog "logs/dev.aldertvaandering-error.log"
        CustomLog "logs/dev.aldertvaandering-access.log" common
        <Directory "D:\WORK\Web Development\Websites\AldertVaandering.com">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order Deny,Allow
            Deny from All
            Allow from 127.0.0.1
            Allow from ::1
        </Directory>
    </VirtualHost>

Open your windows Hosts file in notepad (located at “.\Windows\System32\Drivers\etc”) and add the following:

127.0.0.1 dev.yoursitename

Note: You will have to repeat this for any other site you add, eg:

127.0.0.1 dev.yoursitename 127.0.0.1 dev.mysecondsite

Right click on WAMP and activate Apache -> Services -> Mod-rewrite This will allow WordPress to create those beautiful links we’re used to.

FAQ:

I already set up everything but I get “Permission denied!” If you look at the way we set up the virtual hosts you can see that I’ve added “Allow from ::1″. If you are running Windows Vista or higher chances are you have IPv6 enabled. Apache doesn’t allow access from IPv6 addresses by default and will give you permission denied.

To make apps like phpMyAdmin work you have to open .\WAMP\alias\phpmyadmin.conf and also add Allow from ::1 to the configuration file. Repeat this for every file in .\WAMP\alias\

Amsterdam

The Netherlands

995577386 13+
ln.nasura@olleh
LinkedIn

Arusan

KvK 84379057

1-201 taartskceeblaW