The difference between localhost and 127.0.0.1 under Win7

  
        

First look at the default PING localhost


The address is ::1, this is an IPV6 address

Then we modify localhost in hosts The address is 127.0.0.1, this does not need to know, ping localhost must be the following results


In other words, the default Win7 or higher system, including Win2008 will resolve localhost to: :1 go.

Practice tells us that if you use localhost in php in this case it will be much slower than 127.0.0.1. The above picture

is also the forum of discuz (unmodified hosts file), in the case of connecting localhost:


In the case of connecting 127.0.0.1


The difference is more than one hundred times, and the gap is quite scary.

But I don't know the reason for this difference, but I also want people who know it to tell.

Copyright © Windows knowledge All Rights Reserved