How to install WordPress on your local environment (XAMPP / MAMP)

Learn how to set up a local WordPress development environment

A Local Environment, also known as a Localhost, is basically an offline web server that you run from your own computer. As it is using files stored on your hard drive, websites as well as all other scripts and software will run much faster than if it were online. This makes it easy to develop websites or software locally and is an essential part of any web developers toolbox.

Install WordPress Localhost
Image Source: StockSnap – Pixabay.com / License: CC0 Public Domain

In this article we shall take a look at what software is available that provides us with the ability to create our own localhost web server with ease. And, how would a beginner go about installing WordPress on it? Every WordPress website requires certain software to function correctly. Typically this is Apache, PHP, and MySQL. Manually installing this software can be a challenging task. Especially if you have never installed server software before it might be a very daunting one, too.

This is where such helpful tools as XAMPP and MAMP come in. They will take care of installing all necessary software that enables you to get going in just a few moments. Let’s take a brief look at what software is available, and the differences between them.

XAMPP vs. MAMP: The gloves are off

Let us start with our first option MAMP, which originally started as a MAC-only environment, but now also offers a Windows option, too. It comes in two variants, a free version and a pro version.

The free version of MAMP is all you will need. It includes all of the necessary software required to locally host your own database-driven websites. Whereas the pro version is generally suited to advanced users looking for additional features such as multiple PHP versioning, Virtual Servers, and Dynamic DNS, features we don’t need for the purpose of this article.

XAMPP and MAMP
Image Source: Screenshot – apachefriends.org / mamp.info

XAMPP on the other hand comes in one version and it’s free. The actual differences between XAMPP and the free version of MAMP are very minimal indeed. Each providing all the software (Apache, MySQL, PHP, Python, Perl, etc. ) you need to correctly install WordPress locally.

They both also provide a simple interface that allows you to manage various aspects of running a web server on your computer. In general both XAMPP and MAMP options provide a setup-once-and-leave installation process. My personal preference is XAMPP, but work colleagues use MAMP. The choice is rather negligible if we’re only using it for WordPress installations.

How to fix Port 80 problems

So you’ve made your choice between XAMPP or MAMP and correctly installed the software your chosen local environment provides you with. Upon opening one of the software applications, certain communication ports on your computer will be accessed for use of creating a useable web server.

One of the most common issues a beginner can come across when trying to set up a local environment is Apache requiring the use of Port 80. This can easily be rectified by finding which software on your computer is currently using port 80 and instructing it to use an alternative port.

A good example is Skype using port 80 which prevents XAMPP and MAMP from running its Apache software. Yet, without this software you can’t follow this tutorial to run a local WordPress site on your computer, so it’s not something we can ignore. This can be fixed via the Tools => Options => Advanced => Connection menu from within Skype itself. Simply uncheck the Use port 80 and 443 for additional incoming connections check box and restart your computer.

Alternatively, via the Tools => Options => General menu, you can instruct Skype not to run automatically when your computer is turned on. This will leave port 80 free for other software that demands the use of it. So ensure, that you don’t have any software installed and running which is using this port as well, preventing you to get your web server started.

Start your Local Environment

Locate the folder where you installed MAMP or XAMPP on your computer. There you should see a collection of folders and files. Now locate the /htdocs folder, this is the root of your localhost web server. You can view your localhost web server using your preferred browser via the following URL:

http://localhost/

XAMPP files

You can create folders within the /htdocs folder if you want to install other websites or scripts. They can be accessed by appending the above URL with the folder name, much like a normal web address. For the purposes of this article, we will install WordPress within a folder called /wordpress. Therefore, the URL we will be using to access our WordPress site will be:

http://localhost/wordpress

Downloading WordPress

Visit the WordPress.org website and download the latest version of WordPress to your computer. Save the file to somewhere easily accessible such as your desktop.

Download WordPress
Image Source: Screenshot – WordPress.org

Extract the contents of the archive file you have just downloaded and you will be presented with a collection of files and folders. Simply copy them all into the /wordpress folder we just created within the /htdocs folder. You are now ready to follow the standard WordPress installation procedure.

Create a Database using phpMyAdmin

To create the required database for our WordPress installation, we shall use the phpMyAdmin software that comes bundled with both XAMPP and MAMP. To access phpMyAdmin simply click the particular link within the XAMPP / MAMP options panel or append your localhost root URL with phpMyAdmin, it’s case sensitive so be sure to get it right, like so:

http://localhost/phpMyAdmin

If you’re unfamiliar with database software, then don’t be alarmed when you’re presented with what must be a daunting page to beginners, don’t fear, we’re only here for a moment.

phpMyAdmin

Click the Databases tab at the top of the page, and in the field directly below the Create database text, enter the name of the database you want to create. For the purposes of this article, we shall call it wordpress. For the Collation field select your preferred Unicode Character Sets. Hit the Create button to complete the database creation process. Once done, you can close phpMyAdmin.

Installing WordPress on your Local Environment

WordPress can be installed quite easily, so let’s see if we can make it happen in just a few minutes. Using your preferred web browser, go to your WordPress installation within your local environment using the URL we mentioned earlier, like so:

http://localhost/wordpress

You will be presented with a configuration page requesting database information from you. Since we’re only dealing with a local installation of WordPress, we can simply use some default login information, as shown in the image below.

WordPress Installation

Database Name is the name of the database we created using phpMyAdmin a few moments ago, in our case, wordpress. The Username and Password fields can simply be the standard username & password combination defined by the localhost software, root, and the Database Host is localhost.

The Table Prefix field is useful if you are running multiple WordPress installations using a single database, we won’t be doing that at this time so leave it as the default value of wp_. Hit the Submit button and wait for WordPress to do its thing.

Installation Complete

To finish the installation of WordPress, fill in the welcome page with all of the requested information, such as a title for your local WordPress site and your admin account username and password combination. Your WordPress installation on your local environment is now ready to go, simply login using your chosen admin username and password.

Your WordPress website will now work as though it is online – although it is running on your local environment. You can go ahead and install WordPress themes and plugins just like with any other WordPress installation. You may now tweak, modify and customize your WordPress website locally.

Share this with your friends

Leave a Comment

Your email address will not be published.


*