A local server, in its simplest definition, is a web server that exists on a local system, such as your desktop computer, and is not accessible by the world wide web. It’s a common practice in web development as a whole, but it plays an especially vital role in WordPress development due to its ability to allow you to test a variety of different components on a WordPress site without having to pay for a live server or affect the live version of a site.

WordPress contains a variety of different components that allow it to behave and perform the way it does. A typical WordPress setup includes an operating system for the server application to run on (Windows, OS X or Linux), a web server application (Apache), a database management system (MySQL or MariaDB) and a programming language (PHP). This is why you’ll see many applications se these components as acronyms for their names:

  • MAMP
    • My Apache MySQL PHP
  • LAMP
    • Linux Apache MySQL PHP (or Python or Perl)
    • X (Cross Platform) Apache MariaDB PHP Perl

We’re going to learn how to create a local test server for WordPress using MAMP in this post, but first, let’s start with why developers use test servers and why you specifically would want to go through the trouble of creating one.

Reasons to Use a Local Server for WordPress

There are a number of different reasons to use a local server for WordPress, as stated before. Let’s quickly go through the most popular reasons before diving into the tutorial aspect of this post.

WordPress Development

WordPress is an open-source content management system, which means anyone can build and release a plugin, theme or function for it. Thorough testing with an intent to eliminate bugs must be conducted before the developer can safely release the plugin or theme into the wild. A local test server gives the developer the ability to test his product in a controlled environment without having to pay for a server from a web host.

Testing Purposes

Have you ever wanted to try out a new theme or plugin or even apply changes or updates to your site? Doing so to a live site is dangerous. A number of different things can go wrong when you apply changes to a website, especially if a plugin or theme is coded poorly without your knowledge of it. A local server allows you to test a plugin or theme without affecting your live site. You can also migrate your site over to a local server to test changes and updates.


There are a number of different ways to create a test server for WordPress. They include creating a subdomain on the server that hosts your live site, purchasing an entirely new server or even using a dedicated staging service, such as WP Stagecoach. However, a new server or staging service costs money, and a subdomain is only going to have a negative impact on the amount of storage and bandwidth you use on the server that’s hosting your live site.

Whatever your reason for creating a local test server for WordPress might be, we’re going to show you to set one up in this tutorial.

Introduction to MAMP

MAMP stands for My Apache MySQL PHP, as stated before. It’s compatible with Mac and Windows systems (check out XAMPP or AMPPS if you’re on Linux), and it comes with a number of additional components, including Nginx, Perl and Python. It has a pro version that comes with a number of nifty features developers will love, but we’re going to keep things simple and focus on the free version in this tutorial.

Visit the MAMP Downloads page to get started. Choose your operating system, and click Download to download the application’s installer.

Download MAMP

Run the installer once it finishes downloading. Select the language you want to use, and Click OK. Click Next when the installer asks you if you want to continue. You can go ahead and give the free trial of MAMP PRO a try, but I’m going to untick it for the purposes of this tutorial.

Install MAMP Pro

Accept the user agreement, and select the folder you’d like to install the application in if you don’t want to use the default setting your system uses, which is typically the C drive for Windows machines. Select whether or not you’d like to create a desktop icon, and click Install.

Setting Up MAMP

Open MAMP after it installs to start your servers. If the servers aren’t attempting to start when you open the application, click the Start/Stop button. You’ll know they’ve successfully started when both servers have a filled-in, green square next to them.

MAMP - Start Servers

These servers can take awhile to start, so I recommend not playing with the Start/Stop button too much if you feel it’s taking too long.

Click the Preferences button, and click over to the Ports tab. There are two buttons here, which are:

  • Set MAMP Ports to Default
  • Set Web & MySQL Ports to 80 & 3306

Clicking the first option changes the Apache port to 8888. This means you’ll need to add “8888” at the end of the URL you use to access your local server in your browser. The second button changes the Apache port to 80. You won’t need to enter anything extra into the browser if you use this option. You may, however, have to enter your computer’s password every time you launch the local servers. It may also cause issues if other programs on your system, such as Skype, use Port 80. I typically use Port 80, but do what seems best for you.

Press OK once you’re done choosing a port.

Creating a Database for WordPress

Since we’re using MAMP, we’ll use MySQL to manage our database and phpMyAdmin to access it. Click the Open Start Page button.

MAMP - Open Start Page

This will open the MAMP Start Page in your web browser. Click the phpMyAdmin link on this page.


Click Databases.

phpMyAdmin - Databases

Choose a name for your database. I’m going to name my database “wp” for this tutorial, but you can name yours anything you want. It’s best to keep it short yet descriptive. For example, if I was creating a test server for ThemeFurnace, I could name the database “tfdb” for ThemeFurnace Database. Click Create once you’re done.

phpMyAdmin - Create Database

Close phpMyAdmin.

Installing WordPress

Okay, so we have our local server and have created a database for it. The last step is to install WordPress. Open the folder you installed MAMP in. This should typically be the C drive for Windows systems.

Open the MAMP folder, and open a folder named “htdocs.” This folder should be empty. Go to the WordPress download page to download the CMS. It’ll be the blue “Download WordPress x.x.x” button.

Download WordPress

Unzip the ZIP file you downloaded to extract the folders inside. This should reveal a folder named “wordpress.” Rename this folder to the same name as your database, and drag it over to your htdocs folder.

Open the folder, and rename the “wp-config-sample.php” file to “wp-config.php”.


Open wp-config.php in your preferred text editor. I’m using Brackets in the screenshot below. Find the MySQL Settings section. We’re going to change DB_NAME, DB_USER and DB_PASS. If you re-open the MAMP start page, you’ll notice the username and password for MySQL are both “root.”

Enter your database name for DB_NAME, “root” for DB_USER and “root” for DB_PASS. Be sure to enter the text between the single quotation marks.

MySQL Settings

Save the file once you’re done, and open your browser. Enter “localhost/databasename” in the address bar to access the WordPress installer. I named my database “wp,” so I would enter “localhost/wp”. If you chose to use port 8888, you’ll need to enter “localhost:8888/databasename” instead.

Select a language once you open the installer.

WordPress Installer - Language

Fill in the fields on the next page, and make sure you write down or memorize your username and password or add them to your password manager. Click Install WordPress once you’re done.

You’ll see a success message shortly after. Click Log In to log into your brand new local test server for WordPress.

WordPress Installed

If you want to access your server after you shut down or restart your system, simply open MAMP to start your servers, go to your browser, and enter “localhost/databasename/wp-admin” into the address bar.

Installing More Databases

If you want to create a new WordPress site to test something that doesn’t relate to your default site, all you need to do is repeat the steps:

  1. Launch MAMP.
  2. Open the Start Page.
  3. Click phpMyAdmin.
  4. Navigate to the Databases tab.
  5. Enter your desired database name, and click Create.
  6. Download WordPress.
  7. Extract the folders.
  8. Rename the “wordpress” folder to your database name.
  9. Rename “wp-config-sample.php” to “wp-config.php”.
  10. Change the DB_NAME to your database name, DB_USER to “root” and DB_PASS to “root” in the wp-config.php file, and save it.
  11. Enter “localhost/databasename” in your browser.
  12. Follow the steps to install WordPress.

That’s pretty much it for this tutorial. We’ll mention migrating your site over to this server in the wrap up.

Final Thoughts

Creating a local test server for WordPress can seem intimidating, but it’s actually fairly straightforward, as we’ve demonstrated in this tutorial. You’ve created a brand new WordPress installation you can use to build new sites, test your own products and test themes/plugins.

If you want to test changes to your existing site or test updates, use a plugin like All-in-One WP Migration. Install the plugin on your live site, and use it to export your site into a single file. Install the same plugin on your test server, and use it to import the file. It’s that simple. Another popular solution is a plugin called Duplicator.

We hope this tutorial was helpful to you, and we hope you get a lot of use out of your new test server for WordPress.

About The Author

Oliver Dale is the founder of Kooc Media, an online company which has been working with WordPress since 2009. He has written hundreds of posts about WordPress in that time and founded two theme companies which provide free and paid themes to millions of users.

Google + / Twitter / Pinterest / Facebook

Disclosure: Some of the links in this post may be "affiliate links." This means if you click on the link and purchase an item, We will receive an affiliate commission