Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YII php framework localhost works but 127.0.0.1 does not

Tags:

php

mysql

yii

I'm following a book "Agile Web Application Development with Yii" and I am setting up a database connection to the Yii application through an application component.

I followed the books instructions and said the mysql db host is 127.0.0.1. I ran a test and it failed to connect.

Then I changed the host to "localhost" and it works.

Does anyone know why this is the case?

like image 833
Robert Avatar asked Feb 03 '26 01:02

Robert


1 Answers

Check the file name host at this location

C:\WINDOWS\system32\drivers\etc

Check the default value of localhost in the host file, by default it should be 127.0.0.1 if not, change it to 127.0.0.1. Now try to access your wamp server by using 127.0.0.1 on any web browser.

like image 98
NKM Avatar answered Feb 04 '26 15:02

NKM



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!