Today I’ll discuss about Localhost or 127.0.0.1, which creates an environment to the developer for running PHP, asp script on their own computer. We all are familiar with localhost or 127.0.0.1 who are involved in web development or web design. But most of us don’t know about how it is work.
Or if you don’t have any website then learn more from here.
Do you have idea about website but can not decide which one you will choose wordPress.com vs wordPress.org. So you can read https://loudmyblog.com/wordpress-com-vs-wordpress-org-which-one-you-will-choose/
At first, we need to know about the domain name and IP address.
What is Domain Name?
Nowadays every people of here and there are using the internet and different website. Mostly they are using FACEBOOK and GOOGLE. A domain name is the name of a website which made the website different from all. Every domain name is different from all and there is no repeated domain name. As an example when we want to browse Google then we type GOOGLE.COM in the browser. Here GOOGLE.COM is the domain name. Like FACEBOOK.COM, WIKIPEDIA.ORG is the Domain Name.
And You won’t find the second name like Google, Facebook and another name cause Domain name is the non-repeated name.
What is the IP address?
The word IP stands for “internet protocol”. In the world, all devices and all domain name have a different IP address. It is the combination of a number from 0-255. Every domain name has its own IP address and it is also a non-repeated number. At first when the website was created then they need to input IP address instead of Domain name to access the web. But there are 330.6 Million domain names in 2017. That means there are also 330.6 million different IP address without mobiles, computers IP address. But still, you can access any website by input IP address instead of the domain name but is too much harder.
What is Localhost or 127.0.0.1
Localhost is a hostname which always used to define the local computer address and its IP address is 127.0.0.1. It is used to access own computer by loopback interface. A computer IP address can be 22.214.171.124 but every computer and every device define the IP address 127.0.0.1 as own hosted IP address. And this IP is not available for an internet host. It can host only the own file into offline if your computer is still online. But for enabling localhost or 127.0.0.1 you just need software or application that creates an environment to run localhost in a personal computer. This can be done by XAMPP or WAMP.
How To Install Xampp for localhost
- You need to install Xampp before running a PHP script in Localhost
- First, download the XAMPP software from apachefriends.org.
- Then run it. Then the next screen will appear.
- Click next to select which component you want to install and click next.
- Now select the location where you want to install it.
- Now click next and installation process will start.
- When the software window will open it will look like the next image.
- Start APACHE for a run PHP script and start MYSQL for running SQL.
If WAMP or XAMPP is enabled and enter 127.0.0.1 in your browser it will show the result of the file you are hosting in the htdocs folder of installation dierectory. And If you input 127.X.X.X [X=0 to 255] in your browser it will open the same. There is more than 16 million address which does the same process. It is called the Loopback mechanism.
Why we need localhost or 127.0.0.1