0

I have installed clean copies of XAMPP on completely clean installs of multiple Windows 7 and Windows 8 machines in an attempt to get PHPMyAdmin to work on any computer with any set up and have not been able to.

All the machines exhibit the following strange error.

When attempting to connect to 127.0.0.1/phpmyadmin -or- localhost/phpmyadmin:

Error Message

But - if the machine has a local network IP of, say, 192.168.1.12, and I navigate my browser to: 192.168.1.12/phpmyadmin - it loads just fine with no error!

So, my computers can connect to PHPMyAdmin on themselves through the network, or to each other through the network just fine, but never from localhost.

This is the right section when I access PHPMyAdmin through the network like that: PHPMyAdmin details

What I've Tried:

I've spent many hours trying every possible fix I could find on online forums, including:

  • Editing my computer's host file
  • Editing xampp/phpmyadmin/config.inc.php a thousand different ways
  • Reinstalling XAMPP, reinstalling windows and XAMPP, manually uninstalling and reinstalling MySQL / PHP / PHPMyAdmin, etc.
  • Trying to learn about sockets and if there might be a MySQL socket error of some kind that I'm unable to diagnose. However, MySQL is running just fine and I can start a command line and log in as root and run MySQL commands. I can also run PHP PDO MySQL commands from my own localhost web apps without issue, so I'm almost positive the PHPMyAdmin install is to blame as opposed to MySQL itself.

No matter what I do, I can always run PHPMyAdmin just fine from 192.168.1.x/phpmyadmin, but never from 127.0.0.1/phpmyadmin or localhost/phpmyadmin.

Please, someone, anyone - with any advice or pointers at all - help a frustrated coder out.

Thank you.

Leng
  • 2,948
  • 2
  • 21
  • 30
  • How does your httpd.conf look like? – Pieter Jul 15 '13 at 20:24
  • anything special in your hosts file ? – Callombert Jul 15 '13 at 20:25
  • @metareviewr These are all completely clean copies of Windows with no alterations to the hosts file. I've tried altering the hosts file countless ways and nothing helps. (Including adding the line `127.0.0.1 localhost`, etc) – Leng Jul 15 '13 at 20:27
  • @Pieter These are all clean copies of XAMPP with no editing to httpd.conf or any other file. I've uploaded the default XAMPP httpd.conf here if you'd like to view it: http://junkgrave.com/httpd.conf.txt - thank you! – Leng Jul 15 '13 at 20:28
  • Something to do with your network then ?! Home network or university ? – Callombert Jul 15 '13 at 20:29
  • And `phpmyadmin.conf`? (Located at /wamp/apps/phpmyadmin.../) – Pieter Jul 15 '13 at 20:30
  • @Pieter XAMPP does not use a `phpmyadmin.conf` file, unfortunately. – Leng Jul 15 '13 at 20:31
  • @metareviewr Afraid it's not a network issue, I've tried it on home networks, work networks, and school networks, as well as with no network whatsoever. All have the same result. – Leng Jul 15 '13 at 20:31
  • @Pieter However, there is a `xampp/phpmyadmin/config.inc.php` that I've uploaded for your review here: http://junkgrave.com/config.inc.php.txt – Leng Jul 15 '13 at 20:33
  • What happens when you `ping localhost` or `ping 127.0.0.1` do you get a response? – Pitchinnate Jul 15 '13 at 21:07
  • Can you post your hosts file? – Pitchinnate Jul 15 '13 at 21:08
  • I can ping either just fine. I can also access any web file on them just fine, such as `127.0.0.1/blah.html` or `localhost/blah.html` - the web server works great. The MySQL server also works great, I can do queries on it at `127.0.0.1/mysqltest.php` for instance. And, just to reiterate, PHPMyadmin works great when I access it from 192.168.1.12, just not 127.0.0.1 or localhost – Leng Jul 15 '13 at 21:12
  • @Pitchinnate Here's my hosts file: http://junkgrave.com/hosts.txt – Leng Jul 15 '13 at 21:12

2 Answers2

1

I think I see your issue. I think the issue is with your config.inc.php if you look at the error it says:

"Connection for controluser as defined in your configuration failed."

So I'm pretty sure your problem is coming because of these lines of code:

/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';

For now try only keeping these lines in your config.inc.php and see if it works. You can either delete the rest or comment the rest out. Also you could try changing auth_type to 'cookie'.

/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */

/*
 * Servers configuration
 */
$i = 0;

/*
 * First server
 */
$i++;

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';

Based off the fact that the php page is coming up and phpmyadmin is giving you an error means it isn't a problem with your hosts file or you .conf file. My guess is you always copy and paste that same config.inc.php file so you are getting the same problem on every machine.

Pitchinnate
  • 7,517
  • 1
  • 20
  • 37
  • Thank you so much for this solution, you're absolutely correct. Do you think I should raise a flag with XAMPP to have those `controluser` lines removed from their default `phpmyadmin/config.inc.php`? It doesn't break localhost connections for Windows XP, but it does for Windows 7 and Windows 8. – Leng Jul 15 '13 at 21:21
  • No problem. Not sure I always copy and paste my config.inc.php file into any new installation of PhpMyAdmin because I have like 10 servers setup with custom setting so I don't know what comes in the default one. Also FYI if you would have typed in that error you would have found quite a few answers: http://stackoverflow.com/questions/11506224/connection-for-controluser-as-defined-in-your-configuration-failed-phpmyadmin-xa – Pitchinnate Jul 15 '13 at 21:25
  • Good advice. Perhaps the problem was that I was searching with Google instead of with Stack Overflow's search function. I tried going through dozens of Stack Overflow answers related to similar questions but never came across the one you just linked to. – Leng Jul 15 '13 at 21:29
0

127.0.0.1 is the same as localhost and refers to your actual computer. If you try to connect to 127.0.0.1, phpMyAdmin tries to open a connection to the local MySQL Server(which only exists on the one machine, you installed it..)

If you want a central MySQL Server, you have to use the correct ip adress(can be determined with ifconfig/ipconfig) and use that one. Second, you have to allow foreign connection to this server. The default behavior is to only allow Connections from 127.0.0.1(which is only the MySQL Server machine). To allow root access from foreign machines, you have to edit the mysql.ini file which contains as far as i know a property which disallow connections to root from foreign machines.

Philipp
  • 15,377
  • 4
  • 35
  • 52
  • I do not want a central MySQL server, nor do I want to access PHPMyAdmin over the network. I want to access it from either: `127.0.0.1/phpmyadmin` or from `localhost/phpmyadmin`. Neither is currently possible. I can, however, access it just fine from: `192.168.1.12/phpmyadmin`. That's the problem I'm trying to solve. – Leng Jul 15 '13 at 20:38
  • So, basically, I can easily access PHPMyAdmin from the network (and multiple other machines). I can also easily access it from the same machine it's on, but I have to type in the machine's network address instead of localhost. I want to be able to type in localhost (or 127.0.0.1) from the -same- machine. – Leng Jul 15 '13 at 20:39
  • is 127.0.0.1 and 192.168.1.12 the same machine? – Philipp Jul 15 '13 at 20:42
  • Yes, absolutely. They're both my local machine. If you run `cmd.exe` and type `ipconfig`, it will tell you your network IP, such as `192.168.1.8`, for instance. Then, if you open a browser, you should be able to go to `127.0.0.1` OR to `192.168.1.8`, and they should both point to the same place: your local web server. – Leng Jul 15 '13 at 20:43
  • For some reason, PHPMyAdmin in particular is only accepting the connection from 192.168.1.12 and it isn't accepting it from 127.0.0.1. – Leng Jul 15 '13 at 20:46
  • But thats your Problem - you have two different phpmyadmin installations - one on your local computer(192.168.1.8), which can't access the Server and one on 192.168.2.12, which can access the mysql server – Philipp Jul 15 '13 at 20:49
  • No, Phil - I was using 192.168.1.8 only as an example to explain the concept to you. Let me start over. There is ONE machine on my entire network - there are no other computers. If I point my browser to 127.0.0.1/blah.html - I see the html file hosted on my actual computer. If I point my browser to 192.168.1.12/blah.html - I, once again, see the exact same html file on the exact same actual computer. If I point my browser to 127.0.0.1/phpmyadmin - I see an error message. If I point my browser to 192.168.1.12/phpmyadmin - I see no error message and it works fine. – Leng Jul 15 '13 at 20:53
  • The question I posted above is this: Why does it work fine from 192.168.1.12 and not work at all from 127.0.0.1? Bearing in mind, I have tried this on 6 machines now, all with TOTALLY CLEAN copies of windows and xampp, and ALL of them do exactly the same thing. – Leng Jul 15 '13 at 20:54
  • Ok, i see.. - what did the error logs say? Did you get some warnings/errors if you restart Apache? Have you set some Firewall rules? Have you configured some vhosts? – Philipp Jul 15 '13 at 21:02
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/33513/discussion-between-leng-and-philipp) – Leng Jul 15 '13 at 21:04