Install WordPress on localhost

Install WordPress on localhost

Installing WordPress on localhost will be our first step before learning WordPress. As WordPress is developed in the programming language PHP, so there is need of some server to run PHP programming language on our computer for using WordPress. To Install WordPress on localhost we can use different software which will be discussed later but first we have to know what is localhost.

What is localhost?

Localhost means the computer you are using currently. As we discussed in a previous tutorial, websites need hosting, so for practice purposes we will be using our own computer as hosting for the website and the good thing about localhost environment is that we don’t need internet connection to access websites on localhost because the website is already present on our computer storage.

Advantages of localhost

  • No internet connection is needed.
  • Load website fast
  • Can share websites with others when got connected to internet
  • Easy configuration

How to make localhost

For running the programming language PHP we need a server named Apache Server. There are different applications available for making localhost, some of the major ones are here but we will be using XAMPP.

Applications for localhost

  • WampServer
  • Apache HTTP Server
  • Zend Framework and much more.

What is XAMPP?

Install WordPress on localhost
XAMPP for all Operating Systems

XAMPP means cross-platform Apache MariaDB PHP Perl. We will be using XAMPP for installation of WordPress on localhost. Good thing is that XAMPP is supported by all operating systems (Windows, Linux, OS X). Its installation process is quite simple. Just download the XAMPP version which is supported by your operating system and follow the installation wizard. So to install WordPress on localhost you have to install XAMPP on your computer.

Running XAMPP

To run XAMPP, open the XAMPP Control Panel and start Apache Server and MySQL. By running these two you will be able to run PHP on this server and will be able to use MySQL for databases.

Running Xampp
To start XAMPP

After starting these two click on the Admin button or open your browser and type http://localhost in the URL bar.

Open localhost
To Open localhost in browser by typing http://localhost

After this if the below page appears it means that the installation of XAMPP was successful and XAMPP is now running.

XAMPP localhost
XAMPP is working

Till this point the installation of XAMPP was successful, now the second part is to install WordPress on localhost / install WordPress on XAMPP.

Install WordPress on localhost

1) First download WordPress.

2) Then after downloading WordPress copy the zip file to …/xampp/htdocs. If you followed the default instructions during installation then the path will be c:\xampp\htdocs (in case of windows). As I copy the WordPress downloaded file to htdocs.

Install WordPress on localhost
Copy WordPress file to htdocs

Then extract the file here, the result folder will be wordpress

Install WordPress on localhost
This is the extracted folder

3) Now give this folder any name of your choice which you want to be the name of your website. In my case I will rename this to dotcode. The folder is renamed and now if you open the folder there will be a file named wp-config-sample.php open that file in any text editor.

Installation of WordPress on localhost
Rename folder and edit file

Now editing file

4) Open the file in the text editor and change three things, database name, database user & database password

Set database name to same as folder name, set username to root, and set password empty. As below code.

WordPress installation
Edit these things with the code below.
define( 'DB_NAME', 'dotcode' ); //add your folder name instead of dotcode

/** MySQL database username */
define( 'DB_USER', 'root' );

/** MySQL database password */
define( 'DB_PASSWORD', '' );

5) After editing these save the file and rename it to wp-config.php.

Install WordPress on localhost
Config file renamed

6) Now the last step is to go to the browser http://localhost and open phpMyAdmin

Install WordPress on localhost

7) Then create a database with the same name as the folder you created. In my case I will give it the name dotcode.

Create database
Install WordPress on localhost
Enter folder name and click on create

8) Now it’s time to see WordPress in the browser. Now type http://localhost/your-folder-name. In my case I will type http://localhost/dotcode. And see the WordPress installation and setup page. Simply follow the instruction and fill the whole info and this was the installation step.

WordPress installation language selection
Select language
Install WordPress on localhost
Fill required information and click on Install WordPress
WordPress installation completed

WordPress installation completed, now click on login button or type http://localhost/your-folder-name/wp-adminI will type as http://localhost/dotcode/wp-admin to login to my website.

WordPress installation on Xampp
This is admin panel

And by typing http://localhost/folder-nameyou will see your website’s front page. In the next tutorial we will be studying about themes in WordPress to change our website look.

Xampp wordpress installation
Website front-end

Watch Video Guide