Setting up a local WordPress development environment

If you are using WordPress as the publishing platform for your essential online content then you know that there are always changes that need to be made, updates to apply, and general maintenance that needs to be performed. And you understand the stress involved if you make a mistake and cause your blog or website to go down. Mistakes happen, code updates do have bugs in them. So what can you do to protect yourself? In this, the first in a series of articles, I am going to walk you through some simple steps to safeguard your WordPress powered blog or website.

The most basic step to safely managing a WordPress site is to set up a development environment. There are a number of ways we can do this – Install WordPress locally on your PC or laptop; Install WordPress on a virtual machine; and Install WordPress on a separate domain or subdomain. Today I am going to discuss setting up a local development environment on your PC of laptop and run through the steps you need to follow to successfully accomplish this.

So why do we need a WordPress development environment and what do we use it for?

The answer is because of change! Change is constant with WordPress as it is in IT generally. Whether it is patching software to guard against a vulnerability, upgrading to a new release of software to take advantage of new features, adding or removing content, or adding, removing or upgrading plugins or themes. Every time you make a change to your production WordPress site there are risks involved. You may not know what those risks are until it’s too late. So why not test what you are doing on a development copy of your site instead of blindly applying that update and crashing your site. No change should ever be made to a live site until it has been tested in a development environment. This should be a hard and fast rule that you follow from now on.

Creating a local development environment using WAMP or MAMP

The chances are that you are reading this on your laptop or PC and that it is running Windows or Apple OS. If so then I have some good news for you. WAMP and MAMP are available to you free of charge to install on your Windows or Apple system to run WordPress on.

WAMP is a Windows application that includes the collection of packages known as Linux, Apache, MySQL and PHP which are the vital base components needed to run WordPress. You can download WAMP at, it is free to use under the GPL license.

MAMP is the Apple equivalent. It creates the same Linux, Apache, MySQL and PHP components on an Apple system. You can download MAMP at, it is also free to use under the GPL license.

The instructions to install WAMP or MAMP are very simple and are described below:

WAMP installation instructions

  1. Download the latest version of WAMP
  2. Run the installer file
  3. Accept the license agreement
  4. Select the destination where you would like to install WAMP or accept the default
  5. Select the start menu folder where you would like to place WAMP’s shortcuts or accept the default
  6. Select whether you want WAMP to auto start, for most users you should leave the checkbox unchecked
  7. Click Install
  8. Midway through the install you will be asked the location to save your websites (DocumentRoot). You can opt to save these under your My Documents or accept the default
  9. You will then be asked to select your default browser. You can either click Open or find the executable file for your preferred browser
  10. When the installation has completed click Finish
  11. To manually start the WAMP server, click Start>Programs>WampServer>start WampServer
  12. Open your preferred browser and type in the address bar https://localhost. It should display the WAMP homepage signifying a successful installation.

MAMP installation instructions

  1. Download the latest version of MAMP
  2. Open the image and drag the MAMP folder into your Applications folder. You can do the same with the MAMP Pro folder as well
  3. Open the MAMP application and click the Start Servers button
  4. You can check Preferences in MAMP to make sure the Ports are set to 8888 for Apache and 8889 for MySQL. Alternatively you can click the Set to default Apache and MySQL ports button to set them to port 80 for Apache and port 3306 for MySQL
  5. You can also check that the version under PHP is set to PHP 5 and that your Document Root under Apache is set to /users/your username/Sites
  6. Click the Open start page button. A browser window should appear with the Welcome to MAMP message

Now that you have installed WAMP or MAMP we can go ahead and start to set up WordPress. The first step in the WordPress installation process is to create a database for WordPress to use. To do this, follow the instructions below:

Setting up a database for WordPress

  1. Click on the phpMyAdmin tab in WAMP or MAMP
  2. Under Actions you will see a Create new database box. Enter a name for your database, making sure that it is descriptive and unique. Do not use spaces and try not to use special characters. Keep it simple, for example: developmentDB01
  3. Leave the dropdown boxes with their default settings and click Create
  4. Next click on the Privileges tab and click Add a new User
  5. Enter a username. Again keep it simple
  6. From the Host dropdown select Local
  7. Enter a password or click the Generate button
  8. Make sure you keep a note of your database name, username, and password. You will need these later
  9. Select the radial next to Grant all privileges on database and then click Check All
  10. At the bottom of the screen click the Go button

Now that the database is set up the next step is to download WordPress and install it. To do this, follow the instructions below:

Installing WordPress locally

  1. Download WordPress from
  2. Copy the WordPress folder to your Document Root. This is the location you specified when installing WAMP or MAMP
  3. Double click on the WordPress folder and find the wp-config-sample.php file
  4. Rename this file so that it is called “wp-config.php”
  5. Edit this file using Notepad or a simple text editor
  6. Scroll down until you find the following text – define(‘DB_NAME’, ‘putyourdbnamehere’);
  7. Replace the text “putyourdbnamehere” with the database name you chose in Step 2 above
  8. Scroll down until you find the following text – define(‘DB_USER’, ‘usernamehere’);
  9. Replace the text “usernamehere” with the username you chose in Step 5 above
  10. Scroll down until you find the following text – define(‘DB_PASSWORD’, ‘yourpasswordhere’);
  11. Replace the text “yourpasswordhere” with the password you chose in Step 7 above
  12. Scroll down until you find the following text –
    define(‘AUTH_KEY’, ‘put your unique phrase here’);
    define(‘SECURE_AUTH_KEY’, ‘put your unique phrase here’);
    define(‘LOGGED_IN_KEY’, ‘put your unique phrase here’);
    define(‘NONCE_KEY’, ‘put your unique phrase here’);
  13. Replace the text “put your unique phrase here” in each line with a random set of characters. These keys can be any variation of random characters. I tend to bang on the keyboard to generate these keys. These should be complex to provide optimal security
  14. Scroll down until you find the following text – $table_prefix  = ‘wp_’;
  15. Replace the text “wp” with a unique name for your database. Keep it simple, do not use special characters
  16. Exit your text editor and save this file
  17. In a browser, go to https://localhost/ or https://localhost:8888/ if you kept the default port in MAMP
  18. You should be redirected to https://localhost/wp-admin/install.php and see a Welcome screen
  19. Enter a Blog Title and Your E-mail
  20. Uncheck the box that says Allow my blog to appear in search engines like Google and Technorati
  21. Click the Install WordPress button
  22. Copy the admin password or make a note of it and click the Log In button
  23. Log in using the admin password you copied in Step 22 above

Congratulations! You now have WordPress installed on your local PC or laptop.

    Steve has over 25 years of project management and service delivery experience. He started his career in defense communications before moving to the British Ministry of Defence where he worked for the British Army. For the past 15 years, Steve has worked in IT, managing large projects and enterprise clients. Recently he has worked with entrepreneurs and small businesses helping them to meet the needs of their growing client base. A recent immigrant from England, he brings some international flavor to the team.

    One comment on “Setting up a local WordPress development environment
    1. Fred Prasuhn says:

      Thank you for sharing your wisdom.

      I maintain a small nonprofit web site. I use MAMP Pro for my dev set up platform. I can import content and database. I have not found instructions, though, on how to make the imported to be truly dev. What I change on my dev site, which is on my local machine, is altering what is on the live site. I have not found the missing information/step to separate the two. Do you have a posting addressing this issue?

      Thanks much..fred

    Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.