How to install WordPress on Localhost

I am sure at some point of WordPress Blogging you would like to install WordPress on localhost or your PC. This is perfectly good to make your small improvements or changes without looking for some wordpress developers. Installing WordPress locally (or localhost) is the foolproof way to make and test changes. Today we will discuss how to install WordPress on your Windows based PC or Laptop.

What we gonna need to install WordPress on our localhost?

If you see the requirements for WordPress. I am sure you have seen that we need basically a web-server (like Apache or Nginx) with a database (like MySQL) and of course PHP5.

So here is the list:

  • A Windows OS PC (Preferred, Windows 7 or later)
  • A Webserver like Apache
  • A Database Server like MySQL
  • PHP 5.3 or later
  • A text editor like Notepad or Notepad++ (Don’t use document editors like WordPad or MS Word)

The tricky thing:

The trick here is to install the whole bunch of software at once. XAMPP will do all the magic we want. This will easily install and configure Apache, MySQL and PHP at once. There are a few more things in XAMPP installation file. But, we do not need them here.

TIP: Download XAMPP having highest version number. e.g. if XAMPP 1.8.2 and 1.8.3 both available, then download 1.8.3.

XAMPP is a cross-platform software and also available for Linux and OS X. But right now I will demonstrate on on Win7 PC.

Step 1: Prepare your server

a) Download and Install XAMPP: Download XAMPP from ApacheFriends (the official site) and install to your system. I would recommend you to install the latest available version. The process will be simple.

b) Turn on your local server: Turn on Apache Webserver and MySQL Database server from XAMPP.

XAMPP Control Panel

  • To start servers go to Start >> XAMPP Control Panel >> Hit “Start” button in front of “Apache” and “MySQL”. Once the servers start you a green background with PIDs and Port Info will appear (like the screenshot below)You may check your server status by visiting http://localhost/ or http://127.0.0.1/.

c) Create Database: Now we will have to create a MySQL database for WordPress. You may use the PHPMyAdmin to do it graphically. Simply visit http://localhost/phpmyadmin/ from your browser.

Your login credentials will be :
Username: root
Password: password

Creating Database adding users to it is pretty easy. Pretty easy and you may create one your WordPress installation. (If you stuck somewhere read this post)

Create DB

  • Give your Database a name. E.g. my_demo_site1
  • Change Collation to utf8_general_ci

phpmyadmin-add-user

  • Find the database on left panel and click it, Now click “Privilege” on the top navigation.
  • You will find a “add user” link. Create your user by giving it a username, password (here the Host should be localhost). Don’t make any thing else on the following section. Just scroll down to right-bottom and click “Go”

phpMyAdmin user creds

Step 2: WordPress Installation

a) Download and move wordpress files to correct directory: Download the latest version of WordPress and place the unzipped/uncompressed files to the directory htdocs (you will find htdocs in XAMPP installation directory.

If you put the wordpress files in a directory called wordpress in htdocs then your wordpress site url will be http://localhost/wordpress/ (by default).

WordPress Installation: I am pretty sure that you already knew about WordPress installation. If you are familiar with famous 5 minutes installation of WordPress then you may go ahead and start doing yourself.

If you don’t remember then you may install wordpress by simply visiting your wordpress site. (Since WordPress is not configured you will land on default Configuration/Installation page.)

In this case http://localhost/wordpress/

  • Click “Create the configuration file” button
  • Click “Lets Go” button on the next page.
  • On this page you will be asked for the following information:
    • Database Name
    • Username
    • Password
    • Database host
    • Table Prefix
  • Fill the above information according your database and username you created earlier. For me (as I shown in the demo) the information will be like this:
    • Database Name: my_example_db
    • Username: my_username
    • Password: 4aqaQtc9s2pR8yyB
    • Database host: localhost <– This will not change in your case too.
    • Table Prefix: random1390_ <– All anything alphanumeric with ending underscore sign
  • If everything gone right (actually, wordpress verifies database credential and preinstall checks) then on the next page you will be asked for the following information:
    • Site Title
    • Username (use anything other than admin just for good habit)
    • Password (twice)
    • Your Email
  • Now hit “Install WordPress”. If everything gone right (and I am pretty sure it will) you will get “Success” message.
  • Congratulations, Your WordPress is now installed on localhost and you may now login.

Check this video if anything unclear in installing WordPress. You may also leave a comment below for any help.