phpmyadmin Forbidden for localhost but not 127.0.0.1
Posted by: RFreund (---.lightspeed.cicril.sbcglobal.net)
Date: February 19, 2012 05:59AM

I'm using Windows Vista
Wamp 2.2

I have installed wamp, localhost works fine and I uploaded a quick test message that worked ok. However when I go to wamp-localhost-tools-phpmyadmin I receive a 403 Forbidden error and says I do not have permission.

If I use: 'localhost/phpmyadmin/' This does not work
If I use: "127.0.0.1/phpmyadmin/" This works fine

How can I fix this?
I seem to be running into problems when trying to access the database from php files - returns that no such host is known.

Thanks in advance!

Options: ReplyQuote
Re: phpmyadmin Forbidden for localhost but not 127.0.0.1
Posted by: stevenmartin99 (Moderator)
Date: February 19, 2012 09:13AM

you need to open c:\windows\system32\drivers\etc\

move the file called hosts to your desktop

open it with an editor and delete EVERYTHING in the file,

then just add one line
127.0.0.1       localhost

save and move back to the folder

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: phpmyadmin Forbidden for localhost but not 127.0.0.1
Posted by: RFreund (---.lightspeed.cicril.sbcglobal.net)
Date: February 19, 2012 03:06PM

Thanks Steve!
So far so good!

Out of curiosity why is do I need to delete everything? What is the issue there? Anything I need to 'watch out for' in deleting everything else?

Options: ReplyQuote
Re: phpmyadmin Forbidden for localhost but not 127.0.0.1
Posted by: stevenmartin99 (Moderator)
Date: February 19, 2012 03:26PM

There shouldnt be much else in it.. # is comment so the majority is comments.


the issue is a line called

::1 localhost

this is the ipv6 equivalent of localhost which then overwrites the previous line and the ipv4 value is discarded.

Not so much a bug, more just a conflict with past and future technology

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: phpmyadmin Forbidden for localhost but not 127.0.0.1
Posted by: RFreund (---.lightspeed.cicril.sbcglobal.net)
Date: February 19, 2012 03:51PM

Thanks again Steve!

I don't want to over extend this thread however any ideas on why I'm having trouble connecting to mysql via php?

Here is the mysql error message:

[docs.google.com]

Options: ReplyQuote
Re: phpmyadmin Forbidden for localhost but not 127.0.0.1
Posted by: stevenmartin99 (Moderator)
Date: February 19, 2012 04:05PM

this is a disaster with windows and php

i have begged for a solution >> [bugs.php.net]

can you paste your mysql connection code? you must speicify "localhost" as the "host"

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: phpmyadmin Forbidden for localhost but not 127.0.0.1
Posted by: RFreund (---.lightspeed.cicril.sbcglobal.net)
Date: February 20, 2012 12:57AM

hmm... I deleted the user then instead of making a user I tried username=root with no password. Then I made a new user and I was able to access the database.

I guessing I made a coding or spelling error the first.

Thanks again!!

Options: ReplyQuote
Re: phpmyadmin Forbidden for localhost but not 127.0.0.1
Posted by: Reliance (---.red.bezeqint.net)
Date: March 08, 2012 01:31PM

This can happen with a perfectly good HOSTS file, even if there is only one line in it.
I have found that Wampserver 2.2d is better than the older versions of 2.2, in this regard.
My localhost works perfectly except for the case of phpMyAdmin, where 127.0.0.1 is needed, even the pages I write myself.

Options: ReplyQuote
Re: phpmyadmin Forbidden for localhost but not 127.0.0.1
Posted by: rezwanur (---.qubee.com.bd)
Date: July 18, 2012 07:09PM

I m using windows7 32bit
Wamp 2.2e

I believe i did everything as told in previous posts. in host file (c:\windows\system32\drivers\etc\) everything except 127.0.0.1 localhost is commented with #.

Still no luck sad smiley

Options: ReplyQuote
Re: phpmyadmin Forbidden for localhost but not 127.0.0.1
Posted by: darkwings (---.98.211.188.pol.ir)
Date: April 22, 2013 12:44PM

stevenmartin99 Wrote:
-------------------------------------------------------
> you need to open c:\windows\system32\drivers\etc\
>
> move the file called hosts to your desktop
>
> open it with an editor and delete EVERYTHING in
> the file,
>
> then just add one line
> 127.0.0.1 localhost
>
> save and move back to the folder

there is no need to delete everything there ,at least I didn't do that ,just edit that file
remove the # before 127.0.0.1 localhost and activate it (assuming there is one)
and there should be a # before ::1 localhost to deactivate that one
for me that did the trick

Options: ReplyQuote


Sorry, only registered users may post in this forum.